[WD 12] MSXML - validation xml avec xsd externe
Voilà je souhaite valider un xml via un xsd externe.
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
|
xmlSchemaCache est un objet Automation "Msxml2.XMLSchemaCache.6.0"
xmlDoc est un objet Automation "Msxml2.DOMDocument.6.0"
xmlDoc>>resolveExternals=True
xmlDoc>>validateOnParse = False
xmlDoc>>async = False
xmlSchemaCache>>add("", "monxsd.xsd")
xmlDoc>>schemas = xmlSchemaCache
xmlDoc>>load(CheminFic+FicName)
SELON xmlDoc>>parseError>>ErrorCode
CAS 0
smachaine += "Everything is ok"+RC
AUTRE CAS
smachaine += xmlDoc>>parseError>>reason |
Mais voilà celà ne me retourne que les erreurs quand mon fichier est mal formé et non quand il y a une erreur liée au fichier XSD.
Si quelqu'un a réussi à faire çà je suis preneur :yaisse2:
Voici mon fichier xml fortement simplifié, mais çà marche pas quand même
Code:
1 2 3 4 5 6 7 8 9
|
<?xml version="1.0" encoding="iso-8859-15"?>
<SHM >
<ShopOrder ShopOrderID="288528" Barcode="">
<Harnesses>
</Harnesses>
</ShopOrder>
</SHM> |
Il devrait y avoir une erreur car le BarCode ne doit pas dans la balsie ShopOrder