Extend an existing DTD

Discussion in 'XML' started by Animanera, Jul 18, 2003.

  1. Animanera

    Animanera Guest

    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. :)
     
    Animanera, Jul 18, 2003
    #1
    1. Advertising

  2. 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!
     
    Richard Tobin, Jul 18, 2003
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Joseph Tilian
    Replies:
    0
    Views:
    355
    Joseph Tilian
    Dec 21, 2004
  2. Ronald Fischer
    Replies:
    4
    Views:
    1,762
    Ronald Fischer
    Mar 17, 2005
  3. nrm
    Replies:
    3
    Views:
    535
  4. Andreas

    extend existing dtd

    Andreas, Feb 14, 2005, in forum: XML
    Replies:
    2
    Views:
    498
    Soren Kuula
    Feb 15, 2005
  5. test
    Replies:
    2
    Views:
    2,044
    Oliver Wong
    Jul 28, 2006
Loading...

Share This Page