added example to xmllint.

This commit is contained in:
tille 2003-12-31 15:36:47 +00:00
parent faf7ad5a9b
commit d2900100db
1 changed files with 32 additions and 0 deletions

View File

@ -455,6 +455,38 @@ DTDDECL "-//Conectiva SA//DTD livros V1.0//EN" "publicacoes/livro
<application>xmllint</application>. More information is available from:
<ulink url="http://tclxml.sourceforge.net/tkxmllint.html" />.
</para>
<section id="xmllint-example"><title>Debugging example using xmllint</title>
<para>The example below shows how you can use <command>xmllint</command> to check your documents. I've created some errors that I made a lot, as a beginning XML writer. At first, the document doesn't come through, and errors are shown:</para>
<screen>
<prompt>bash$</prompt> <command>xmllint</command> <filename>ldp-history.xml</filename></command>
ldp-history.xml:22: error: Opening and ending tag mismatch: articlinfo line 6 and articleinfo
&lt;/articleinfo&gt;
^
ldp-history.xml:37: error: Opening and ending tag mismatch: listitem line 36 and orderedlist
&lt;/orderedlist&gt;
^
ldp-history.xml:39: error: Opening and ending tag mismatch: orderedlist line 34 and sect2
&lt;/sect2&gt;
^
ldp-history.xml:46: error: Opening and ending tag mismatch: sect1 line 41 and para
for many authors to contribute their part in their area of specialization.</para
^
ldp-history.xml:57: error: Opening and ending tag mismatch: para line 55 and sect1
&lt;/sect1&gt;
^
ldp-history.xml:59: error: Opening and ending tag mismatch: sect2 line 31 and article
&lt;/article&gt;
^
ldp-history.xml:61: error: Premature end of data in tag sect1 line 24
^
ldp-history.xml:61: error: Premature end of data in tag article line 5
^
</screen>
<para>Now, as we already mentioned, don't worry about anything except the first error. The first error says there is an inconsistency between the tags on line 6 and line 22 in the file. Indeed, on line 6 we left out the <quote>e</quote> in <quote>articleinfo</quote>. Fix the error, and run <command>xmllint</command> again. The first complaint now is about the offending line 37, where the closing tag for list items has been forgotten. Fix the error and run the validation tool again, until all errors are gone. Most common errors include forgetting to open or close the paragraph tag, spelling errors in tags and messed up sections.</para>
</section>
</section> <!-- end xmllint -->
</section> <!-- end validate -->