Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Schema Validation
Message
General information
Forum:
Visual FoxPro
Category:
XML, XSD
Environment versions
Visual FoxPro:
VFP 8
OS:
Windows XP SP1
Database:
Visual FoxPro
Miscellaneous
Thread ID:
00988563
Message ID:
00989150
Views:
67
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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform