########################################################################################## # # # heureusement, les outils logiciels vérifient les grammaires avant # # d'effectuer la validation : # # # ########################################################################################## # ----------------------------------# # # # 1. test de bad.dtd # # # # ----------------------------------# ########################################################################################## $gh> cat baddtd.xml # le fichier XML est bien formé ########################################################################################## ########################################################################################## $gh> cat bad.dtd # l'erreur est flagrante ########################################################################################## ########################################################################################## $gh> rxp baddtd.xml ########################################################################################## Error: Syntax error after < in dtd # ----------------------------------# # # # 2. test de bad.xsd # # # # ----------------------------------# ########################################################################################## $gh> rxp bad.xsd # la grammaire XSD est bien formée ########################################################################################## ########################################################################################## $gh> rxp badxsd.xml # le fichier XML est bien formé ########################################################################################## ########################################################################################## $gh> cat bad.xsd # l'erreur est flagrante ########################################################################################## ########################################################################################## $gh> xmllint --noout --schema bad.xsd badxsd.xml # erreur sur la grammaire détectée ########################################################################################## bad.xsd:2: namespace error : Namespace prefix xsd on schema is not defined schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" ^ bad.xsd:3: namespace error : Namespace prefix xsd on lmnt is not defined ^ bad.xsd:4: namespace error : Namespace prefix xsd on complexType is not defined ^ bad.xsd:5: namespace error : Namespace prefix xsd on sequence is not defined ^ bad.xsd:6: namespace error : Namespace prefix xsd on element is not defined ^ bad.xsd:10: namespace error : Namespace prefix xsd on element is not defined ^ Schemas parser error : The XML document 'bad.xsd' is not a schema document. WXS schema bad.xsd failed to compile ########################################################################################## $gh> xmllint --noout --schema bad.xsd badxsd.xml # erreur si xsd mis au lieu de xs ########################################################################################## bad.xsd:3: element lmnt: Schemas parser error : Element '{http://www.w3.org/2001/XMLSchema}schema': The content is not valid. Expected is ((include | import | redefine | annotation)*, (((simpleType | complexType | group | attributeGroup) | element | attribute | notation), annotation*)*). WXS schema bad.xsd failed to compile