Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Embedded DTD - Link to XML

Status
Not open for further replies.

HumbleSeeker

Programmer
Nov 29, 2002
37
0
0
GB
I'm trying to include all the DTD I need for my program in the exe file, by specifying them as embedded resources.

The trouble I'm having is that I can't for the life of me see how I can link the DTDs to the XML documents. I'm using XmlDocument to read the XML.

Dim Xdoc as New XmlDocument()
Xdoc.LoadXml(gblObjRecordSet("xmlContent"))

Anyone got any ideas, suggestions, solutions?

Humble Seeker
-----------------------------------------------------
The longest journey begins with the smallest step.
 
For a DTD that is inside the XML document, you just concatenate them together:
Code:
<!DOCTYPE customer [
	<!ELEMENT customer (type, name, moreinfo)>
]>
<customer>
  <type />
  <name />
  <moreinfo />
</customer>
Chip H.


____________________________________________________________________
Click here to learn Ways to help with Tsunami Relief
If you want to get the best response to a question, please read FAQ222-2244 first
 
Thanks for the reply. The problem is that the DTD I want to include it into the actual exe file. Nice idea though. The problem is also componded by the fact that the XML is from a third party, so I don't really want to do anything that will change the file.

I've pretty sure that you can reference a DTD as an embedded resource, but I don't know how.

Humble Seeker
-----------------------------------------------------
The longest journey begins with the smallest step.
 
Add it to the project, then right-click on it and change it's build option to EmbeddedResource. You can then retrieve it with the ResourceManager class.
Code:
Dim myManager As New _  System.Resources.ResourceManager("ResourceNamespace.myResources", _
myAssembly)

Dim myDTDString As System.String = myManager.GetString("StringResource")
Chip H.


____________________________________________________________________
Click here to learn Ways to help with Tsunami Relief
If you want to get the best response to a question, please read FAQ222-2244 first
 
Thanks. I see what you mean. I'll give it a try.

Humble Seeker
-----------------------------------------------------
The longest journey begins with the smallest step.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top