<NowResolved>[MSXML v4.0 Validation issue with VB6]</NowResolved>
I am experiencing a very annoying problem, which doesn't really seem to have an answer. I have an xml document: http://www.dataforce.co.uk/xml/webform.xml. . It has an external dtd: http://www.dataforce.co.uk/xml/webform.dtd..
I am trying to validate the xml against the dtd by using the following VB Code:
Dim xmlDoc As MSXML2.DOMDocument40
Dim blLoaded As Boolean
Dim xmlError As MSXML2.IXMLDOMParseError
Dim elRoot As MSXML2.IXMLDOMElement
Dim nlChildren As MSXML2.IXMLDOMNodeList
Set xmlDoc = New MSXML2.DOMDocument40
blLoaded = xmlDoc.Load("c:\webform.xml")
If blLoaded Then
Set elRoot = xmlDoc.documentElement
Set xmlError = xmlDoc.Validate
Set nlChildren = elRoot.childNodes
End If
I am stepping through this section of code and before I get to instantiating the xmlError object I run the following in the immediate window:
? xmldoc.parseError.reason
It returns:
The name of the top most element must match the name of the DOCTYPE declaration.
Then I step through till the error object is populated:
? xmlerror.reason
Validate failed because the document does not contain exactly one root node.
Why is this happening? I have validated it using:
http://www.cogsci.ed.ac.uk/~richard/xml-check.html
As recommended in SAMS XML in 21 days.
Can anyone shed some light on this please?