Fri, January 30, 2009
DocBook V5.0 を書いて妥当性検証する方法
必要なもの
- docbook.rng(DocBook5のスキーマ) .... http://www.oasis-open.org/docbook/xml/5.0b5/rng/ から入手
- jing.jar ... http://www.thaiopensource.com/download/ から jing-20030619.zip をダウンロードして入手
XML文書
test.xml
<?xml version="1.0" encoding="UTF-8"?>
<book version="5.0" xmlns="http://docbook.org/ns/docbook"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns:m="http://www.w3.org/1998/Math/MathML"
xmlns:html="http://www.w3.org/1999/xhtml"
xmlns:db="http://docbook.org/ns/docbook">
<info>
<title>ALICE'S ADVENTURES IN WONDERLAND</title>
<author>
<personname><firstname>Lewis</firstname><surname>Carroll</surname></personname>
</author>
</info>
<chapter>
<title xml:id="DOWN_THE_RABBIT-HOLE">DOWN THE RABBIT-HOLE</title>
<para>Alice was beginning to get very tired of sitting by her sister on the bank, and of
having nothing to do. Once or twice she had peeped into the book her sister was reading,
but it had no pictures or conversations in it, "and what is the use of a book," thought
Alice, "without pictures or conversations?"</para>
<para>So she was considering in her own mind (as well as she could, for the day made her
feel very sleepy and stupid), whether the pleasure of making a daisy-chain would be
worth the trouble of getting up and picking the daisies, when suddenly a White Rabbit
with pink eyes ran close by her.</para>
<mediaobject>
<imageobject>
<imagedata format="JPEG" fileref="images/i002.jpg"/>
</imageobject>
</mediaobject>
</chapter>
</book>
妥当性検証
$ java -jar jing.jar docbook.rng text.xml
※エラーがあればメッセージが標準出力される。