Extend an existing DTD

A

Animanera

Is there a way to extend an existing DTD (adding only new elements) OR
I've to create a NEW DTD containing both new and old elements?

Thank you very much in advance.
Bye, Animanera. :)
 
R

Richard Tobin

Animanera said:
Is there a way to extend an existing DTD (adding only new elements) OR
I've to create a NEW DTD containing both new and old elements?

You can write a short new DTD that uses a parameter entity reference
to include the old DTD.

For example, suppose your old DTD was vegetables.dtd and you want to
add an element brussels-sprout, you can put something like this in
new-vegetables.dtd:

<!ENTITY % old SYSTEM "vegetables.dtd">
%old;
<!ELEMENT brussels-sprout EMPTY>
<!ATTLIST brussels-sprout taste #FIXED "disgusting">

The first line declares "old" as an external parameter entity, the old
DTD. The second line includes that entity. Then you continue with
the extra declarations.

This works if you only need to add declarations. If you need to
modify any declarations (for example, to add brussels-sprout to the
content model of some existing element) then you can't do it unless
the original DTD writer planned ahead for it, typically by making the
content models themselves be parameter entities.

-- Richard
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,189
Latest member
CryptoTaxSoftware

Latest Threads

Top