This is the mail archive of the
docbook@lists.oasis-open.org
mailing list for the DocBook project.
Re: [docbook] Adding a new element to docbook
On Fri, Aug 22, 2003 at 10:51:17AM -0500, JABakken@dstsystems.com wrote:
>
> I'm still working on adding a new element to docbook, and am becoming
> pretty confused. Here's what I've got so far:
>
> This is mydocbk.dtd:
>
> <!ENTITY % local.tech.char.class "footer">
This declaration needs to have the 'or' symbol added:
<!ENTITY % local.tech.char.class "|footer">
-----------^
so that when it is added at the end of %tech.char.class;
it will fit in with the other or'ed elements.
> <!ENTITY % DocBookDTD PUBLIC "-//OASIS//DTD DocBook V4.2//EN">
> %DocBookDTD;
This PUBLIC identifier is for the SGML version of the
DocBook DTD. Since you are using XML, you need
to use:
"-//OASIS//DTD DocBook XML V4.2//EN"
>
> <!ELEMENT footer - - ((%para.char.mix;|%para.mix;)+)>
Also, the syntax for XML DTDs does not use "- -"
in element declarations.
Also, for mixed content in XML (mixing #PCDATA and
elements), the number of occurances may not be
constrained (see http://www.w3.org/TR/REC-xml#sec-mixed-content).
That means you must use * rather than + in the declaration.
And you should remove the extra parens, leaving:
<!ELEMENT footer (%para.char.mix;|%para.mix;)*>
> This is my test xml file:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE book SYSTEM "file:///C:/DocBook/XSLTest/DTD/mydocbk.dtd">
> <book><title>Book Title</title>
>
> <chapter><title>Using the footer element</title>
> <para>This is only a sample.</para>
> <footer>This is the footer</footer>
> </chapter>
> </book>
So far, you have only added footer to tech.char.class
which is used within paragraphs. So this file won't
validate against your DTD. If you want to use
footer as a sibling to para, you need another local
parameter entity:
<!ENTITY % local.divcomponent.mix "|footer">
This adds footer to the mix of block elements
that can be used in chapter, section, etc.
--
Bob Stayton 400 Encinal Street
Publications Architect Santa Cruz, CA 95060
Technical Publications voice: (831) 427-7796
The SCO Group fax: (831) 429-1887
email: bobs@sco.com
---------------------------------------------------------------------
To unsubscribe, e-mail: docbook-unsubscribe@lists.oasis-open.org
For additional commands, e-mail: docbook-help@lists.oasis-open.org