Results 1 to 2 of 2

Thread: <NowResolved>[MSXML v4.0 Validation issue with VB6]</NowResolved>

  1. #1

    Thread Starter
    Member
    Join Date
    Feb 2000
    Location
    Kettering, Northants, England
    Posts
    56

    Talking <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?
    Last edited by daveejay; Dec 14th, 2001 at 11:22 AM.

  2. #2

    Thread Starter
    Member
    Join Date
    Feb 2000
    Location
    Kettering, Northants, England
    Posts
    56

    Talking

    Just in case anyone is interested I have managed to solve this one, but i have still written to Microsoft to notify them of a bug with the validation:

    I changed the xmlDoc.Load("c:\webform.xml") {Which does exist!} to reference the web version and it worked.

    However, reverting back and then copying the DTD locally and changing the doctype declaration in the webform.xml file to reference the new file came up with the same error.

    Incidentally a massive gotcha is the fact that VB even with the web based reference does not validate against the DTD as standard, I dug around ( a hell of a lot) and found that there is a property of the document -

    xmlDoc.resolveExternals = True

    That seems to be the only way to get it to actually use the external DTD.

    Thanks

    Dave

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width