Now datz a what i'm a talkin about. Mr. ValidateOnParse is the guy I should have been looking at!
What amazes me about XML / XSD is how DOM "merges' the XSD elements with the XML. An XML file, before it is loaded, may have very little resemblence to how it is rendered once "schemalocations" are merged. Some XMLs in my project have 8 or 9 XSD's!
I've read and done the w3 tutorials (several times) related to XSD and DTD. And I still have no idea of the "hows" and "whys" of an XML/XSD merge. I look at the final result (afer the load) and go "Okay..". I would like to be able to look at an XSD and imagine how the merge will look afterwards.
Thanks for the "ValidateOnParse" pointer!
>Hi,
>
>>>
>I use DOM methods to crawl through the XML to assure that the required node and attributes are in the package. There is usually an expectation of what should be in the package.
>
>What does the DOM Validate method do?
>>>
>
>Pretty much the same thing <s>. You can either validate an XMLDocument against a scheme when it is loaded by setting the .validateOnParse property(VB example from documentation:)
>
>
>Dim xmlDoc As New Msxml2.DOMDocument30
>xmlDoc.async = False
>xmlDoc.validateOnParse = True
>xmlDoc.Load "books.xml"
>If (xmlDoc.parseError.errorCode <> 0) Then
> Dim myErr
> Set myErr = xmlDoc.parseError
> MsgBox("You have error " & myErr.reason)
>End If
>
>
>or achieve the same thing after loading with:
>
>
>Dim xmlDoc As New Msxml2.DOMDocument30
>xmlDoc.async = False
>xmlDoc.Load "books.xml"
>xmlDoc.Validate
>If (xmlDoc.parseError.errorCode <> 0) Then
> Dim myErr
> Set myErr = xmlDoc.parseError
> MsgBox("You have error " & myErr.reason)
>End If
>
>
>The benefit of the later is that you can load the doc, add/change nodes and validate the modified result.
>
>Regards,
>Viv
Imagination is more important than knowledge