Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / XML / July 2008

Tip: Looking for answers? Try searching our database.

Is this scenario possible?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
B. Chernick - 03 Jul 2008 15:33 GMT
I've included an xml and a dtd file in my Resources folder (This is a
Winforms VB project in VS2005.)  I'm planning on using the xml in Resources
as a 'template', just load it and change values.  The beginning code is:

 Dim xDoc As New XmlDocument
 xDoc.LoadXml(My.Resources.NameOfXMLFile)
 ... do some stuff to XDoc

Given that, is it possible to use a DTD in Resources to validate the XML?  

(I admit I'm having some trouble following the documentation on this point.)
Martin Honnen - 03 Jul 2008 15:42 GMT
> I've included an xml and a dtd file in my Resources folder (This is a
> Winforms VB project in VS2005.)  I'm planning on using the xml in Resources
[quoted text clipped - 5 lines]
>
> Given that, is it possible to use a DTD in Resources to validate the XML?  

That should be possible by using a custom implementation of XmlResolver
that ensures that the system identifier is resolved by loading the DTD
from the resource.

Signature

    Martin Honnen --- MVP XML
    http://JavaScript.FAQTs.com/

B. Chernick - 03 Jul 2008 18:08 GMT
That's just it.  The basic ref states that it 'Resolves external XML
resources named by a Uniform Resource Identifier (URI). '  Does this apply to
this situation?  

> > I've included an xml and a dtd file in my Resources folder (This is a
> > Winforms VB project in VS2005.)  I'm planning on using the xml in Resources
[quoted text clipped - 9 lines]
> that ensures that the system identifier is resolved by loading the DTD
> from the resource.
Martin Honnen - 04 Jul 2008 12:13 GMT
> That's just it.  The basic ref states that it 'Resolves external XML
> resources named by a Uniform Resource Identifier (URI). '  Does this apply to
> this situation?  

Based on your previous post where you have
  <!DOCTYPE BDD SYSTEM "EAI.dtd">
the EAI.dtd is a (relative) URI that needs to be resolved to load the
external DTD. If you put that into a .NET assembly as a resource then
you need to provide a custom implementation of XmlResolver so that the
XML parser finds the DTD in the assembly.
See
http://www.hanselman.com/blog/LoadingXmlSchemaFilesOutOfAssemblyResources.aspx
for an example, it deals with schemas but the mechanism is the same
whether the parser needs to access a referenced DTD or a referenced schema.

Signature

    Martin Honnen --- MVP XML
    http://JavaScript.FAQTs.com/


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.