Re: Embed XML into DocBook XML

From
Steinar Bang <>
Date
2006-05-30T06:08:39+00:00
ID
Thread
Re: Embed XML into DocBook XML
>>>>> "Danilo Reinhardt" <>:

> whats the correct way to embedded a xml based file (schemata/xsd) as
> formatted/inlined "source code" into a docbook xml? Are there any
> helper programs to do this task?

(Note that this question is more suited to docbook-apps)

I have used three ways of doing this:
 1. Paste the XML source code into a <programlisting> element and
    replace all "<" characters with "&lt;"
 2. Paste the XML source code into a CDATA section inside a
    <programlisting> element, ie.
	<programlisting><![CDATA[]]></programlisting>
    The XML source then goes before the first closing bracket, eg.
	<programlisting><![CDATA[<?xml version="1.0" ?>
<myxml>
 <mysubelem/>
</myxml>
]]></programlisting>

 3. Use an <xi:include href="somefile.xml" parse="text"> inside a
    <programlisting> element.  Note that the latter means that you
    will need an XSLT processor that understands XInclude (I use
    xsltproc, which does), and that if you have a DTD or schema aware
    editor, you may need to add XInclude to your DTD.
    This is my preferred solution, because it allows me to have my
    document depend on and use "live" and tested code