Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > Extend an existing DTD

Reply
Thread Tools

Extend an existing DTD

 
 
Animanera
Guest
Posts: n/a
 
      07-18-2003
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.
 
Reply With Quote
 
 
 
 
Richard Tobin
Guest
Posts: n/a
 
      07-18-2003
In article < >,
Animanera <> wrote:

>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
--
Spam filter: to mail me from a .com/.net site, put my surname in the headers.

FreeBSD rules!
 
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
XML file from one DTD to another DTD test Java 2 07-28-2006 08:48 PM
How to specify DTD to DTD.getDTD for DocumentParser? Ronald Fischer Java 4 03-17-2005 09:37 AM
extend existing dtd Andreas XML 2 02-15-2005 11:15 AM
Removing the dtd name when using print(...) on the dtd generated class Joseph Tilian Java 0 12-21-2004 02:58 PM
Including a dtd into another dtd... possible? Asfand Yar Qazi XML 1 09-19-2003 12:10 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