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
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