IF YOU WOULD LIKE TO GET AN ACCOUNT, please write an
email to Administrator. User accounts are meant only to access repo
and report issues and/or generate pull requests.
This is a purpose-specific Git hosting for
BaseALT
projects. Thank you for your understanding!
Только зарегистрированные пользователи имеют доступ к сервису!
Для получения аккаунта, обратитесь к администратору.
</style><title>Validation & DTDs</title></head><bodybgcolor="#8b7765"text="#000000"link="#000000"vlink="#000000"><tableborder="0"width="100%"cellpadding="5"cellspacing="0"align="center"><tr><tdwidth="120"><ahref="http://swpat.ffii.org/"><imgsrc="epatents.png"alt="Action against software patents"/></a></td><tdwidth="180"><ahref="http://www.gnome.org/"><imgsrc="gnome2.png"alt="Gnome2 Logo"/></a><ahref="http://www.w3.org/Status"><imgsrc="w3c.png"alt="W3C Logo"/></a><ahref="http://www.redhat.com/"><imgsrc="redhat.gif"alt="Red Hat Logo"/></a><divalign="left"><ahref="http://xmlsoft.org/"><imgsrc="Libxml2-Logo-180x168.gif"alt="Made with Libxml2 Logo"/></a></div></td><td><tableborder="0"width="90%"cellpadding="2"cellspacing="0"align="center"bgcolor="#000000"><tr><td><tablewidth="100%"border="0"cellspacing="1"cellpadding="3"bgcolor="#fffacd"><tr><tdalign="center"><h1>The XML C parser and toolkit of Gnome</h1><h2>Validation & DTDs</h2></td></tr></table></td></tr></table></td></tr></table><tableborder="0"cellpadding="4"cellspacing="0"width="100%"align="center"><tr><tdbgcolor="#8b7765"><tableborder="0"cellspacing="0"cellpadding="2"width="100%"><tr><tdvalign="top"width="200"bgcolor="#8b7765"><tableborder="0"cellspacing="0"cellpadding="1"width="100%"bgcolor="#000000"><tr><td><tablewidth="100%"border="0"cellspacing="1"cellpadding="3"><tr><tdcolspan="1"bgcolor="#eecfa1"align="center"><center><b>Main Menu</b></center></td></tr><tr><tdbgcolor="#fffacd"><formaction="search.php"enctype="application/x-www-form-urlencoded"method="get"><inputname="query"type="text"size="20"value=""/><inputname="submit"type="submit"value="Search ..."/></form><ul><li><ahref="index.html">Home</a></li><li><ahref="intro.html">Introduction</a></li><li><ahref="FAQ.html">FAQ</a></li><li><ahref="docs.html"style="font-weight:bold">Developer Menu</a></li><li><ahref="bugs.html">Reporting bugs and getting help</a></li><li><ahref="help.html">How to help</a></li><li><ahref="downloads.html">Downloads</a></li><li><ahref="news.html">News</a></li><li><ahref="XMLinfo.html">XML</a></li><li><ahref="XSLT.html">XSLT</a></li><li><ahref="xmldtd.html">Validation & DTDs</a></li><li><ahref="encoding.html">Encodings support</a></li><li><ahref="catalog.html">Catalog support</a></li><li><ahref="namespaces.html">Namespaces</a></li><li><ahref="contribs.html">Contributions</a></li><li><ahref="examples/index.html"style="font-weight:bold">Code Examples</a></li><li><ahref="html/index.html"style="font-weight:bold">API Menu</a></li><li><ahref="guidelines.html">XML Guidelines</a></li></ul></td></tr></table><tablewidth="100%"border="0"cellspacing="1"cellpadding="3"><tr><tdcolspan="1"bgcolor="#eecfa1"align="center"><center><b>Related links</b></center></td></tr><tr><tdbgcolor="#fffacd"><ul><li><ahref="http://mail.gnome.org/archives/xml/">Mail archive</a></li><li><ahref="http://xmlsoft.org/XSLT/">XSLT libxslt</a></li><li><ahref="http://phd.cs.unibo.it/gdome2/">DOM gdome2</a></li><li><ahref="http://www.aleksey.com/xmlsec/">XML-DSig xmlsec</a></li><li><ahref="ftp://xmlsoft.org/">FTP</a></li><li><ahref="http://www.zlatkovic.com/projects/libxml/">Windows binaries</a></li><li><ahref="http://garypennington.net/libxml2/">Solaris binaries</a></li><li><ahref="http://www.zveno.com/open_source/libxml2xslt.html">MacOsX binaries</a></li><li><ahref="http://sourceforge.net/projects/libxml2-pas/">Pascal bindings</a></li><li><ahref="http://bugzilla.gnome.org/buglist.cgi?product=libxml2">Bug Tracker</a></li></ul></td></tr></table></td></tr></table></td><tdvalign="top"bgcolor="#8b7765"><tableborder="0"cellspacing="0"cellpadding="1"width="100%"><tr><td><tableborder="0"cellspacing="0"cellpadding="1"width="100%"bgcolor="#000000"><tr><td><tableborder="0"cellpadding="3"cellspacing="1"width="100%"><tr><tdbgcolor="#fffacd"><p>Table of Content:</p><ol><li><ahref="#General5">General overview</a></li>
</ol><h3><aname="General5"id="General5">General overview</a></h3><p>Well what is validation and what is a DTD ?</p><p>DTD is the acronym for Document Type Definition. This is a description of
the types of those attributes.</p><h3><aname="definition1"id="definition1">The definition</a></h3><p>The <ahref="http://www.w3.org/TR/REC-xml">W3C XML Recommendation</a> (<ahref="http://www.xml.com/axml/axml.html">Tim Bray's annotated version of
usable for complex DTD design.</p><h4><aname="reference1"id="reference1">How to reference a DTD from a document</a>:</h4><p>Assuming the top element of the document is <code>spec</code> and the dtd
<code>dtds</code> of the directory from where the document were loaded:</p><p><code><!DOCTYPE spec SYSTEM "dtds/mydtd"></code></p><p>Notes:</p><ul><li>The system string is actually an URI-Reference (as defined in <ahref="http://www.ietf.org/rfc/rfc2396.txt">RFC 2396</a>) so you can use a
</ul><h4><aname="Declaring2"id="Declaring2">Declaring elements</a>:</h4><p>The following declares an element <code>spec</code>:</p><p><code><!ELEMENT spec (front, body, back?)></code></p><p>It also expresses that the spec element contains one <code>front</code>,
<code>div1</code> elements:</p><p><code><!ELEMENT div1 (head, (p | list | note)*, div2?)></code></p><p>which means div1 contains one <code>head</code> then a series of optional
text:</p><p><code><!ELEMENT b (#PCDATA)></code></p><p><code>b</code> contains text or being of mixed content (text and elements
in no particular order):</p><p><code><!ELEMENT p (#PCDATA|a|ul|b|i|em)*></code></p><p><code>p </code>can contain text or <code>a</code>, <code>ul</code>,
order.</p><h4><aname="Declaring1"id="Declaring1">Declaring attributes</a>:</h4><p>Again the attributes declaration includes their content definition:</p><p><code><!ATTLIST termdef name CDATA #IMPLIED></code></p><p>means that the element <code>termdef</code> can have a <code>name</code>
directly included within the document.</p><h3><aname="validate1"id="validate1">How to validate</a></h3><p>The simplest way is to use the xmllint program included with libxml. The
1.0 specification:</p><p><code>xmllint --valid --noout test/valid/REC-xml-19980210.xml</code></p><p>the -- noout is used to disable output of the resulting tree.</p><p>The <code>--dtdvalid dtd</code> allows validation of the document(s)
against a given DTD.</p><p>Libxml2 exports an API to handle DTDs and validation, check the <ahref="http://xmlsoft.org/html/libxml-valid.html">associated
should be both simple and complete enough to allow you to build your own.</p><p></p><p><ahref="bugs.html">Daniel Veillard</a></p></td></tr></table></td></tr></table></td></tr></table></td></tr></table></td></tr></table></body></html>