Re: gtk-doc xml stuff



Matthias Clasen wrote:

You can achieve the same with entities (SUBDOC entities). But it is not so
important that the sections are valid, its more important the the resulting document is valid. And you loose validation for IDREFs if you move to xinclude, AFAIK.
I just did a test of xincludes, and xmllint can definitely check the idrefs if you pass the --postvalid argument (which validates after parsing). Here is an example:

----- Start foo.xml -----
<?xml version="1.0" standalone="no"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
   "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd";>

<sect1 id="some-id" xmlns:xi="http://www.w3.org/2001/XInclude";>
 <title>Some section</title>

 <para>This is a link to <link
 linkend="some-id">some-id</link>.</para>

 <xi:include href="bar.xml" />
</sect1>
----- End foo.xml -----

----- Start bar.xml -----
<?xml version="1.0" standalone="no"?>
<!DOCTYPE sect2 PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
   "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd";>

<sect2 id="my-sect2">
 <title>Sect2</title>

 <para>Here is another link to <link
 linkend="some-id">some-id</link>.</para>

 <sect3 id="some-id">
   <title>Sect3</title>

   <para>Repeat id!</para>
 </sect3>
</sect2>
----- End bar.xml -----

Save these two files, then run xmllint:

$ xmllint --noout --xinclude --postvalid foo.xml
ID some-id already defined
Document foo.xml does not validate

The document foo.xml will not validate before xinclude processing (due to the <xi:include/> element) but this isn't that big a deal.

James.

--
Email: james daa com au              | Linux.conf.au 2003 Call for Papers out
WWW:   http://www.daa.com.au/~james/ |   http://conf.linux.org.au/cfp.html







[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]