Login or Sign up Help | Site Map
Connecting Tech Pros Worldwide

Is this scenario possible?

Question posted by: =?Utf-8?B?Qi4gQ2hlcm5pY2s=?= (Guest) on July 3rd, 2008 02:35 PM
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.)
Would you like to answer this question?
Sign up for a free account, or Login (if you're already a member).
Martin Honnen's Avatar
Martin Honnen
Guest
n/a Posts
July 3rd, 2008
02:45 PM
#2

Re: Is this scenario possible?
B. Chernick wrote:
Quote:
Originally Posted by
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?


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.

--

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

=?Utf-8?B?Qi4gQ2hlcm5pY2s=?='s Avatar
=?Utf-8?B?Qi4gQ2hlcm5pY2s=?=
Guest
n/a Posts
July 3rd, 2008
05:15 PM
#3

Re: Is this scenario possible?
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?

"Martin Honnen" wrote:
Quote:
Originally Posted by
B. Chernick wrote:
Quote:
Originally Posted by
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?

>
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.
>
--
>
Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
>


Martin Honnen's Avatar
Martin Honnen
Guest
n/a Posts
July 4th, 2008
11:25 AM
#4

Re: Is this scenario possible?
B. Chernick wrote:
Quote:
Originally Posted by
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/Loadi...yResources.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.


--

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

 
Not the answer you were looking for? Post your question . . .
182,200 Experts ready to help you find a solution.
Sign up for a free account, or Login (if you're already a member).

  • Didn't find the answer you were looking for?
    Post Your Question
  • Top Community Contributors