Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Schema Validation
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
XML, XSD
Versions des environnements
Visual FoxPro:
VFP 8
OS:
Windows XP SP1
Database:
Visual FoxPro
Divers
Thread ID:
00988563
Message ID:
00989150
Vues:
57
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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform