Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > Nested <!ENTITY> Tags?

Reply
Thread Tools

Nested <!ENTITY> Tags?

 
 
Ed Dennison
Guest
Posts: n/a
 
      09-11-2003
I'm starting to look at DocBook-XML (not SGML) for producing a large
documentation set. The hierarchy of DocBook elements for organizing
the content is (more or less);

set
book
part
chapter
sect1
sect2
....

Most of the examples and documentation for DocBook-XML describe using
<!ENTITY> tags within a DOCTYPE element to break up a book into
multiple chapter files, like this:

<!DOCTYPE book
PUBLIC "-//OASIS//DTD DocBook XML V4.1//EN"
"file:///c:\home\db\dtd\docbookx.dtd"
[
<!ENTITY preface SYSTEM "userguide.preface.xml" >
<!ENTITY ch1 SYSTEM "userguide.ch1.xml" >
<!ENTITY ch2 SYSTEM "userguide.ch2.xml" >
]
>


<book>
&preface;
&ch1;
&ch2;
</book>

This works fine. But suppose I would like to include my books within a
set. If I do something similar in a set container file:

<!DOCTYPE set
PUBLIC "-//OASIS//DTD DocBook XML V4.1//EN"
"file:///c:\home\db\dtd\docbookx.dtd"
[
<!ENTITY userguide SYSTEM "userguide.book.xml" >
<!ENTITY reference SYSTEM "reference.book.xml" >
]
>


<set>
&userguide;
&reference;
</set>

This does not work fine -- attempting to parse the set file generates
errors because of multiple DOCTYPE elements in a single file (the
DOCTYPE elements in the included book XML files).

As far as I can tell, this means that if I want to use the set
element, each of my DocBook books must be implemented as a single XML
file. This is not practical for large books (such as N. Walsh's
example of an aircraft maintenance manual).

I am interested in what kinds of approaches people take when using
DocBook-XML to work with large documentation sets? Do you eschew the
use of the set element? Use some kind of mechanical means to merge the
parts of a book before processing?

Thanks,

Ed Dennison
Cognex Corporation

e-mail ed at the obvious domain.
 
Reply With Quote
 
 
 
 
Richard Tobin
Guest
Posts: n/a
 
      09-12-2003
In article <> ,
Ed Dennison <> wrote:

><!DOCTYPE book
> PUBLIC "-//OASIS//DTD DocBook XML V4.1//EN"
> "file:///c:\home\db\dtd\docbookx.dtd"
> [
> <!ENTITY preface SYSTEM "userguide.preface.xml" >
> <!ENTITY ch1 SYSTEM "userguide.ch1.xml" >
> <!ENTITY ch2 SYSTEM "userguide.ch2.xml" >
> ]
> >

>
><book>
> &preface;
> &ch1;
> &ch2;
></book>


First of all, note that you could have split out the chapter entity
definitions into an external parameter entity, and used another
external entity to package up all the chapters:

userguide-defs.pe:

<!ENTITY preface SYSTEM "userguide.preface.xml" >
<!ENTITY ch1 SYSTEM "userguide.ch1.xml" >
<!ENTITY ch2 SYSTEM "userguide.ch2.xml" >
<!ENTITY userguide-chapters SYSTEM "userguide-chapters.xml">

userguide-chapters.xml:

&preface;
&ch1;
&ch2;

userguide.xml:

<!DOCTYPE book
PUBLIC "-//OASIS//DTD DocBook XML V4.1//EN"
"file:///c:\home\db\dtd\docbookx.dtd"
[
<!ENTITY % userguide-defs SYSTEM "userguide-defs.pe" >
%userguide-defs;
]
>

<book>
&userguide-chapters;
</book>

Then you could do this:

<!DOCTYPE set
PUBLIC "-//OASIS//DTD DocBook XML V4.1//EN"
"file:///c:\home\db\dtd\docbookx.dtd"
[
<!ENTITY % userguide-defs SYSTEM "userguide-defs.pe" >
%userguide-defs;
<!ENTITY % reference-defs SYSTEM "reference-defs.pe" >
%reference-defs;
]
>


<set>
<book>
&userguide-chapters;
</book>
<book>
&reference-chapters;
</book>
</set>

Still rather more overhead than is desirable, but maybe good enough.

(NB you will have to choose different entity names for the chapters
in each book.)

-- Richard
--
Spam filter: to mail me from a .com/.net site, put my surname in the headers.

FreeBSD rules!
 
Reply With Quote
 
 
 
 
Magnus Henriksson
Guest
Posts: n/a
 
      09-17-2003
"Ed Dennison" <> wrote in message
news: m...


--snip--


> I am interested in what kinds of approaches people take when using
> DocBook-XML to work with large documentation sets? Do you eschew the
> use of the set element? Use some kind of mechanical means to merge the
> parts of a book before processing?



--snip--

Chapter 19 [http://www.sagehill.net/docbookxsl/ModularDoc.html] in 'DocBook
XSL: The Complete Guide' [http://www.sagehill.net/docbookxsl/] has some
pretty good advice for working with modular DocBook files. Assuming you are
processing your sources with N. Walsh's styulesheets.


// Magnus


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Nested friend class in nested template problem tonvandenheuvel@gmail.com C++ 3 12-07-2007 03:02 PM
dealing with nested xml within nested xml within...... Ultrus Python 3 07-09-2007 09:00 PM
Is nested class automatically friend of class that it is nested in? request@no_spam.com C++ 5 09-25-2006 08:31 AM
Nested Vector Nester Classes are Nested in my Brain Chad E. Dollins C++ 3 11-08-2005 04:46 AM
Nested iterators (well, not nested exactly...) Russ Perry Jr Java 2 08-20-2004 06:51 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57