xmllint --noout --dtdvalid madtd.dtd fichier.xml && echo "OK"
|
|
<!ENTITY % verified "verified (yes|no) #REQUIRED">
<!ELEMENT library (author*,book*)>
<!ELEMENT author (name,book_ref*)>
<!ATTLIST author id ID #REQUIRED %verified; sex (M|F) #IMPLIED>
<!ELEMENT name (#PCDATA)>
<!ELEMENT book_ref EMPTY>
<!ATTLIST book_ref isbn IDREF #REQUIRED>
<!ELEMENT book (title,author_ref+)>
<!ATTLIST book isbn ID #REQUIRED %verified; year NMTOKEN #REQUIRED>
<!ELEMENT title (#PCDATA)>
<!ELEMENT author_ref EMPTY>
<!ATTLIST author_ref ref IDREF #REQUIRED>
RENDU: 2.1.xml.
rm 3.0.tar.gz; wget --no-cache http://fabien.viger.free.fr/xml/td2/3.0.tar.gz tar xf 3.0.tar.gz ./3.0.shRENDU: 3.0.dtd.
<!-- Ceci est un EXTRAIT pour vous donner une idée. Teléchargez le fichier complet! -->
<genealogie>
...
<famille fid="def">
<mere pid="p999"/>
<pere_inconnu/>
<enfant pid="p567"/>
<enfant pid="p789"/>
</famille>
...
<famille fid="jkl">
<mere pid="p000"/>
<pere pid="p123"/>
</famille>
...
<personne pid="p567" sex="F">
<fid fid="abc"/>
<fid fid="def"/>
<fid fid="ghi"/>
<nom>Daisy</nom>
<naissance>01/01/1975</naissance>
</personne>
...
<personne pid="p999" sex="F">
<fid fid="def"/>
<nom>Grand-mère Donald</nom>
<naissance_inconnue/>
<mort>12/12/2012</mort>
</personne>
...
</genealogie>
Vérifiez que votre DTD est bien stricte comme cela:
rm 3.1.tar.gz; wget --no-cache http://fabien.viger.free.fr/xml/td2/3.1.tar.gz tar xf 3.1.tar.gz ./3.1.test.shRENDU: 3.1.dtd.