Valid XHTML     Valid CSS2    

Listing du fichier demoXmlTxt.txt

 

00001     
00002     ########################################################################
00003     #
00004     # 1. Test si un document est bien formé
00005     # dbf.xml : document bien formé
00006     # dmf.xml : document mal formé
00007     #
00008     ########################################################################
00009     
00010     # 1a. en perl
00011     
00012     testebfpe
00013      syntaxe : testebf fichier
00014     
00015     testebfpe dbf.xml
00016     
00017     <?xml version="1.0" encoding="ISO-8859-1"?>
00018     <xsd:schema targetNamespace="http://www.interieur.gouv.fr/ACTES#v1.1-20040216"
00019      xmlns:insee="http://xml.insee.fr/schema" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
00020      xmlns:actes="http://www.interieur.gouv.fr/ACTES#v1.1-20040216"
00021      elementFormDefault="qualified" attributeFormDefault="qualified">
00022     <xsd:import namespace="http://xml.insee.fr/schema" schemaLocation="siret.xsd"/>
00023     <xsd:attribute name="Arrondissement">
00024     <xsd:annotation>
00025     [...]
00026      <xsd:element name="Matieres">
00027      <xsd:complexType>
00028      <xsd:sequence maxOccurs="unbounded">
00029      <xsd:element name="Matiere1">
00030      <xsd:complexType>
00031      <xsd:complexContent>
00032      <xsd:extension base="actes:Matiere">
00033      <xsd:sequence maxOccurs="unbounded">
00034      <xsd:element name="Matiere2">
00035      <xsd:complexType>
00036      <xsd:complexContent>
00037      <xsd:extension base="actes:Matiere">
00038      <xsd:sequence minOccurs="0" maxOccurs="unbounded">
00039      <xsd:element name="Matiere3">
00040      <xsd:complexType>
00041      <xsd:complexContent>
00042      <xsd:extension base="actes:Matiere">
00043      <xsd:sequence minOccurs="0" maxOccurs="unbounded">
00044      <xsd:element name="Matiere4">
00045      <xsd:complexType>
00046      <xsd:complexContent>
00047      <xsd:extension base="actes:Matiere">
00048      <xsd:sequence minOccurs="0" maxOccurs="unbounded">
00049      <xsd:element name="Matiere5" type="actes:Matiere"></xsd:element>
00050      </xsd:sequence>
00051      </xsd:extension>
00052      </xsd:complexContent>
00053      </xsd:complexType>
00054      </xsd:element>
00055      </xsd:sequence>
00056      </xsd:extension>
00057      </xsd:complexContent>
00058      </xsd:complexType>
00059      </xsd:element>
00060      </xsd:sequence>
00061      </xsd:extension>
00062      </xsd:complexContent>
00063      </xsd:complexType>
00064      </xsd:element>
00065      </xsd:sequence>
00066      </xsd:extension>
00067      </xsd:complexContent>
00068      </xsd:complexType>
00069      </xsd:element>
00070      </xsd:sequence>
00071      </xsd:complexType>
00072      </xsd:element>
00073      </xsd:sequence>
00074      </xsd:complexType>
00075      </xsd:element>
00076     </xsd:schema>
00077     
00078     Le document nommé dbf.xml est bien formé.
00079     
00080     
00081     testebfpe dmf.xml
00082     
00083     <?xml-stylesheet type="text/xsl" href="titres.xsl"?><FILMS>
00084     <FILM Annee="1958">
00085     <TITRE>Vertigo</TITRE>
00086     <GENRE>Drame</GENRE><PAYS>USA</PAYS><MES idref="3"></MES>
00087     <ROLES>
00088     <ROLE><PRENOM>James</PRENOM><NOM>Stewart</NOM>
00089     [..]
00090     
00091     Document dmf.xml mal formé :
00092     
00093     mismatched tag at line 219, column 43, byte 11057 at /usr/lib/perl5/XML/Parser.pm line 187
00094     
00095     # 1b. en php
00096     
00097     testebfph
00098     
00099     testebf.php (gH) 2012
00100      syntaxe : testebfph fichierXML
00101      exemple : testebfph dmf.xml
00102     
00103     testebfph dbf.xml
00104      Document dbf.xml bien formé
00105     
00106     testebfph dmf.xml
00107     
00108     PHP Warning: DOMDocument::load(): Opening and ending tag mismatch: NOM line 218 and ROLE
00109     in /home/gh/public_html/tuteurs/dmf.xml, line: 219 in /home/gh/Bin/testebf.php on line 26
00110     PHP Stack trace:
00111     PHP 1. {main}() /home/gh/Bin/testebf.php:0
00112     PHP 2. DOMDocument->load() /home/gh/Bin/testebf.php:26
00113     PHP Warning: DOMDocument::load(): expected '>' in /home/gh/public_html/tuteurs/dmf.xml,
00114     line: 220 in /home/gh/Bin/testebf.php on line 26
00115     PHP Stack trace:
00116     PHP 1. {main}() /home/gh/Bin/testebf.php:0
00117     PHP 2. DOMDocument->load() /home/gh/Bin/testebf.php:26
00118     PHP Warning: DOMDocument::load(): Opening and ending tag mismatch: ROLES line 217 and FILM
00119     in /home/gh/public_html/tuteurs/dmf.xml, line: 225 in /home/gh/Bin/testebf.php on line 26
00120     PHP Stack trace:
00121     PHP 1. {main}() /home/gh/Bin/testebf.php:0
00122     PHP 2. DOMDocument->load() /home/gh/Bin/testebf.php:26
00123     PHP Warning: DOMDocument::load(): expected '>' in /home/gh/public_html/tuteurs/dmf.xml,
00124     line: 705 in /home/gh/Bin/testebf.php on line 26
00125     PHP Stack trace:
00126     PHP 1. {main}() /home/gh/Bin/testebf.php:0
00127     PHP 2. DOMDocument->load() /home/gh/Bin/testebf.php:26
00128     PHP Warning: DOMDocument::load(): Premature end of data in tag FILMS line 3
00129     in /home/gh/public_html/tuteurs/dmf.xml, line: 706 in /home/gh/Bin/testebf.php on line 26
00130     PHP Stack trace:
00131     PHP 1. {main}() /home/gh/Bin/testebf.php:0
00132     PHP 2. DOMDocument->load() /home/gh/Bin/testebf.php:26
00133     
00134     Erreur, document dmf.xml mal formé
00135     
00136     # 1c. en java
00137     
00138     # 1d. avec rxp
00139     
00140     rxp -h
00141     usage: rxp [-abemnNsStvVx] [-o b|0|1|2|3] [-c encoding] [-u base_uri] [url]
00142     
00143     rxp -s dbf.xml
00144     
00145     rxp -s dmf.xml
00146     Error: Mismatched end tag: expected </NOM>, got </ROLE>
00147      in unnamed entity at line 219 char 48 of file:///home/gh/public_html/tuteurs/dmf.xml
00148     
00149     # 1e. avec xmllint
00150     
00151     xmllint
00152     Usage : xmllint [options] XMLfiles ...
00153      Parse the XML files and output the result of the parsing
00154      --version : display the version of the XML library used
00155      --debug : dump a debug tree of the in-memory document
00156      --shell : run a navigating shell
00157      --debugent : debug the entities defined in the document
00158      --copy : used to test the internal copy implementation
00159      --recover : output what was parsable on broken XML documents
00160      --huge : remove any internal arbitrary parser limits
00161      --noent : substitute entity references by their value
00162      --noout : don't output the result tree
00163      --path 'paths' : provide a set of paths for resources
00164      --load-trace : print trace of all external entites loaded
00165      --nonet : refuse to fetch DTDs or entities over network
00166      --nocompact : do not generate compact text nodes
00167      --htmlout : output results as HTML
00168      --nowrap : do not put HTML doc wrapper
00169      --valid : validate the document in addition to std well-formed check
00170      --postvalid : do a posteriori validation, i.e after parsing
00171      --dtdvalid URL : do a posteriori validation against a given DTD
00172      --dtdvalidfpi FPI : same but name the DTD with a Public Identifier
00173      --timing : print some timings
00174      --output file or -o file: save to a given file
00175      --repeat : repeat 100 times, for timing or profiling
00176      --insert : ad-hoc test for valid insertions
00177      --compress : turn on gzip compression of output
00178      --html : use the HTML parser
00179      --xmlout : force to use the XML serializer when using --html
00180      --push : use the push mode of the parser
00181      --memory : parse from memory
00182      --maxmem nbbytes : limits memory allocation to nbbytes bytes
00183      --nowarning : do not emit warnings from parser/validator
00184      --noblanks : drop (ignorable?) blanks spaces
00185      --nocdata : replace cdata section with text nodes
00186      --format : reformat/reindent the input
00187      --encode encoding : output in the given encoding
00188      --dropdtd : remove the DOCTYPE of the input docs
00189      --c14n : save in W3C canonical format v1.0 (with comments)
00190      --c14n11 : save in W3C canonical format v1.1 (with comments)
00191      --exc-c14n : save in W3C exclusive canonical format (with comments)
00192      --nsclean : remove redundant namespace declarations
00193      --testIO : test user I/O support
00194      --catalogs : use SGML catalogs from $SGML_CATALOG_FILES
00195      otherwise XML Catalogs starting from
00196      file:///etc/xml/catalog are activated by default
00197      --nocatalogs : deactivate all catalogs
00198      --auto : generate a small doc on the fly
00199      --xinclude : do XInclude processing
00200      --noxincludenode : same but do not generate XInclude nodes
00201      --nofixup-base-uris : do not fixup xml:base uris
00202      --loaddtd : fetch external DTD
00203      --dtdattr : loaddtd + populate the tree with inherited attributes
00204      --stream : use the streaming interface to process very large files
00205      --walker : create a reader and walk though the resulting doc
00206      --pattern pattern_value : test the pattern support
00207      --chkregister : verify the node registration code
00208      --relaxng schema : do RelaxNG validation against the schema
00209      --schema schema : do validation against the WXS schema
00210      --schematron schema : do validation against a schematron
00211      --sax1: use the old SAX1 interfaces for processing
00212      --sax: do not build a tree but work just at the SAX level
00213      --oldxml10: use XML-1.0 parsing rules before the 5th edition
00214     
00215     Libxml project home page: http://xmlsoft.org/
00216     To report bugs or get some help check: http://xmlsoft.org/bugs.html
00217     
00218     xmllint --noout dbf.xml
00219     
00220     xmllint --noout dmf.xml
00221     dmf.xml:219: parser error : Opening and ending tag mismatch: NOM line 218 and ROLE
00222     <INTITULE>Mary Jensen Matthews</INTITULE></ROLE><ROLE><PRENOM>Mat</PRENOM><NOM>D
00223      ^
00224     dmf.xml:220: parser error : expected '>'
00225     <INTITULE>Pat Healy</INTITULE></ROLE></ROLES>
00226      ^
00227     dmf.xml:225: parser error : Opening and ending tag mismatch: ROLES line 217 and FILM
00228     </FILM>
00229      ^
00230     dmf.xml:705: parser error : expected '>'
00231     </FILMS>
00232      ^
00233     dmf.xml:706: parser error : Premature end of data in tag FILMS line 3
00234     
00235     
00236     xmlstarlet
00237     XMLStarlet Toolkit: Command line utilities for XML
00238     Usage: xml [<options>] <command> [<cmd-options>]
00239     where <command> is one of:
00240      ed (or edit) - Edit/Update XML document(s)
00241      sel (or select) - Select data or query XML document(s) (XPATH, etc)
00242      tr (or transform) - Transform XML document(s) using XSLT
00243      val (or validate) - Validate XML document(s) (well-formed/DTD/XSD/RelaxNG)
00244      fo (or format) - Format XML document(s)
00245      el (or elements) - Display element structure of XML document
00246      c14n (or canonic) - XML canonicalization
00247      ls (or list) - List directory as XML
00248      esc (or escape) - Escape special XML characters
00249      unesc (or unescape) - Unescape special XML characters
00250      pyx (or xmln) - Convert XML into PYX format (based on ESIS - ISO 8879)
00251      p2x (or depyx) - Convert PYX into XML
00252     <options> are:
00253      --version - show version
00254      --help - show help
00255     Wherever file name mentioned in command help it is assumed
00256     that URL can be used instead as well.
00257     
00258     Type: xml <command> --help <ENTER> for command help
00259     
00260     XMLStarlet is a command line toolkit to query/edit/check/transform
00261     XML documents (for more information see http://xmlstar.sourceforge.net/)
00262     
00263     xmlstarlet val -w dbf.xml
00264     dbf.xml - valid
00265     
00266     xmlstarlet val -w dmf.xml
00267     dmf.xml:219: parser error : Opening and ending tag mismatch: NOM line 218 and ROLE
00268     <INTITULE>Mary Jensen Matthews</INTITULE></ROLE><ROLE><PRENOM>Mat</PRENOM><NOM>D
00269      ^
00270     dmf.xml:220: parser error : expected '>'
00271     <INTITULE>Pat Healy</INTITULE></ROLE></ROLES>
00272      ^
00273     dmf.xml:225: parser error : Opening and ending tag mismatch: ROLES line 217 and FILM
00274     </FILM>
00275      ^
00276     dmf.xml:705: parser error : expected '>'
00277     </FILMS>
00278      ^
00279     dmf.xml:706: parser error : Premature end of data in tag FILMS line 3
00280     
00281     ^
00282     dmf.xml - invalid
00283     
00284     ########################################################################
00285     #
00286     # 2. Test si un document est valide pour sa dtd
00287     # adv.xml : document valide pour id.dtd
00288     # adn.xml : document non valide pour id.dtd
00289     #
00290     ########################################################################
00291     
00292     # 2a. en perl
00293     
00294     testevdpe
00295      syntaxe : testevd fichier_XML fichier_DTD
00296     
00297     testevdpe adv.xml id.dtd
00298     <id>
00299      <nom> BOND </nom>
00300      <prenom> James </prenom>
00301     </id>
00302     Le document nommé adv.xml est valide pour sa dtd nommée id.dtd
00303     
00304     testevdpe adn.xml id.dtd
00305     <id>
00306      <nom> BOND </nom>
00307     </id>XML::Checker ERROR-154: bad order of Elements Found=[nom] RE=[((nom)(prenom))]
00308      Context: line 5, column 0, byte 98
00309     Le document nommé adn.xml est non valide pour sa dtd nommée id.dtd
00310     
00311     # 2b. en php
00312     
00313     testevdph
00314     
00315     testevd.php (gH) 2012
00316      syntaxe : testevdph fichierXML fichierDTD
00317      exemple : testevdph dnv.xml id.dtd
00318     
00319     testevdph adv.xml id.dtd
00320     Document adv.xml bien formé et valide pour id.dtd
00321     
00322     testevdph adn.xml id.dtd
00323     PHP Warning: DOMDocument::validate(): Element id content does not follow the DTD, expecting (nom , prenom), got (nom ) in /home/gh/Bin/testevd.php on line 30
00324     PHP Stack trace:
00325     PHP 1. {main}() /home/gh/Bin/testevd.php:0
00326     PHP 2. DOMDocument->validate() /home/gh/Bin/testevd.php:30
00327     
00328     Erreur, document adn.xml non valide pour id.dtd
00329     
00330     # 2c. en java
00331     
00332     # 2d. avec rxp
00333     
00334     rxp -V -s adv.xml
00335     
00336     rxp -V -s adn.xml
00337     Warning: Content model for id does not allow it to end here
00338      in unnamed entity at line 5 char 5 of file:///home/gh/public_html/tuteurs/adn.xml
00339     
00340     # 2e. avec xmllint
00341     ?xmllint --valid --noout dbf.xml
00342     ?xmllint --valid --noout dmf.xml
00343     
00344     # 2f. avec xmlstarlet
00345     
00346     xmlstarlet val --help
00347     XMLStarlet Toolkit: Validate XML document(s)
00348     Usage: xml val <options> [ <xml-file-or-uri> ... ]
00349     where <options>
00350      -w or --well-formed - validate well-formedness only (default)
00351      -d or --dtd <dtd-file> - validate against DTD
00352      -s or --xsd <xsd-file> - validate against XSD schema
00353      -E or --embed - validate using embedded DTD
00354      -r or --relaxng <rng-file> - validate against Relax-NG schema
00355      -e or --err - print verbose error messages on stderr
00356      -b or --list-bad - list only files which do not validate
00357      -g or --list-good - list only files which validate
00358      -q or --quiet - do not list files (return result code only)
00359     
00360     NOTE: XML Schemas are not fully supported yet due to its incomplete
00361      support in libxml2 (see http://xmlsoft.org)
00362     
00363     XMLStarlet is a command line toolkit to query/edit/check/transform
00364     XML documents (for more information see http://xmlstar.sourceforge.net/)
00365     
00366     xmlstarlet val -d id.dtd adv.xml
00367     adv.xml - valid
00368     
00369     xmlstarlet val -d id.dtd adn.xml
00370     adn.xml:5: element id: validity error : Element id content does not follow the DTD, expecting (nom , prenom), got (nom )
00371     </id>
00372      ^
00373     adn.xml:3: element id: validity error : Element id content does not follow the DTD, expecting (nom , prenom), got (nom )
00374     adn.xml - invalid
00375     
00376     ########################################################################
00377     #
00378     # 3. Test si un document est valide pour sa xsd
00379     # axv.xml : document valide pour id.xsd
00380     # axn.xml : document non valide pour id.xsd
00381     #
00382     ########################################################################
00383     
00384     # 3a. en perl
00385     
00386     testevspe
00387      syntaxe : testevsp fichier[.xml] schema[.xsd]
00388     
00389     testevspe axv.xml id.xsd
00390     <id xsi:noNamespaceSchemaLocation="id.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
00391      <nom> BOND </nom>
00392      <prenom> James </prenom>
00393     </id>
00394     Le document axv.xml est valide pour son schéma xsd.
00395     
00396     testevspe axn.xml id.xsd
00397     le document nommé axn.xml n'est pas valide pour son schéma : Contents of element 'id' do not match content model '(nom,prenom)'.
00398     <id xsi:noNamespaceSchemaLocation="id.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
00399      <nom> BOND </nom>
00400     </id>
00401     
00402     # 3b. en php
00403     
00404     testevsph
00405     
00406     testevs.php (gH) 2012
00407      syntaxe : testevsph fichierXML fichierXSL
00408      exemple : testevsph dv.xml id.xsd
00409     
00410     testevsph axv.xml id.xsd
00411     Document axv.xml bien formé et valide pour id.xsd
00412     
00413     testevsph axn.xml id.xsd
00414     PHP Warning: DOMDocument::schemaValidate(): Element 'id': Missing child element(s). Expected is ( prenom ). in /home/gh/Bin/testevs.php on line 38
00415     PHP Stack trace:
00416     PHP 1. {main}() /home/gh/Bin/testevs.php:0
00417     PHP 2. DOMDocument->schemaValidate() /home/gh/Bin/testevs.php:38
00418     
00419     Erreur, document axn.xml non valide pour id.xsd
00420     
00421     # 3c. en java
00422     
00423     # 3d. avec xmlstarlet
00424     
00425     xmlstarlet val -s id.xsd axv.xml
00426     axv.xml - valid
00427     
00428     xmlstarlet val -s id.xsd axn.xml
00429     axn.xml - invalid
00430     
00431     ########################################################################
00432     #
00433     # 4. Transformation XSL sur un document XML
00434     #
00435     ########################################################################
00436     
00437     # 4a. en perl
00438     # 4b. en php
00439     # 4c. en java
00440     # 4c. avec xmlstarlet
00441     
00442     xmlstarlet tr --help
00443     XMLStarlet Toolkit: Transform XML document(s) using XSLT
00444     Usage: xml tr [<options>] <xsl-file> {-p|-s <name>=<value>} [<xml-file>...]
00445     where
00446      <xsl-file> - main XSLT stylesheet for transformation
00447      <xml-file> - input XML document file/URL (stdin is used if missing)
00448      <name>=<value> - name and value of the parameter passed to XSLT processor
00449      -p - parameter is XPATH expression ("'string'" to quote string)
00450      -s - parameter is a string literal
00451     <options> are:
00452      --help or -h - diplay help message
00453      --omit-decl - omit xml declaration <?xml version="1.0"?>
00454      --embed or -E - allow applying embedded stylesheet
00455      --show-ext - show list of extensions
00456      --val - allow validate against DTDs or schemas
00457      --net - allow fetch DTDs or entities over network
00458      --xinclude - do XInclude processing on document input
00459      --maxdepth val - increase the maximum depth
00460      --html - input document(s) is(are) in HTML format
00461      --catalogs - use SGML catalogs from $SGML_CATALOG_FILES
00462      otherwise XML catalogs starting from
00463      file:///etc/xml/catalog are activated by default
00464     
00465     XMLStarlet is a command line toolkit to query/edit/check/transform
00466     XML documents (for more information see http://xmlstar.sourceforge.net/)
00467     
00468     Current implementation uses libxslt from GNOME codebase as XSLT processor
00469     (see http://xmlsoft.org/ for more details)
00470     
00471     #xmlstarlet val -s id.xsd axv.xml
00472     
00473     # 4d. avec xsltproc

Pour ne pas voir les numéros de ligne, ajoutez &nl=non à la suite du nom du fichier.

 

 

retour gH    Retour à la page principale de   (gH)