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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help! Error validating XML against DTD in VB 6

Status
Not open for further replies.

CraigB1

Programmer
Joined
Mar 15, 2004
Messages
4
Location
GB
Hi All,

I am trying to use a DTD to validate an xml file my app loads. I am using MSXML 3.0 and xmlSchemaCache, the code I use is almost straight from the msdn help file:

'load string into XML DOM
Set objXMLDoc = New MSXML2.DOMDocument
Set objSchemaCache = New MSXML2.XMLSchemaCache

** objSchemaCache.Add "", App.Path & "\ryder.dtd" **

Set objXMLDoc.schemas = objSchemaCache

objXMLDoc.async = False
objXMLDoc.loadXML (strXMLString)

Select Case objXMLDoc.parseError.errorCode

But when I try and load my perfectly valid xml and DTD I get a type mismatch on the ** line above.

I have tried it with the files from the Microsoft example and it works fine, however I dont use namespaces! but according to the help file objSchemaCache.add can have the namespace field left blank as above, but apparantly not!!

I am really confused, do I have to use namespaces in order for VB to be able to validate it? why? If not what else could be causing the type mismatch, and ultimatley I have no intention of using namespaces and so how do I go about validating using a dtd without namespaces in VB??

P.S I know the schema and XML are well formed and valid because if I dont use the schemaCache and use 'validate on parse' property and hard code the dtd location into the xml file, it parses fine. However it is not gona be possible for me to do this because of the app nature.

Thanks in advance

Craig
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top