DTD question

Discussion in 'XML' started by wzhang, Nov 14, 2003.

  1. wzhang

    wzhang Guest

    Hi,

    I would like to add some custom elements to svg files and also some
    custom attributes to certain svg elements. Should I create a DTD to
    include the cumtom elements and attributes?

    <!ATTLIST {element name} {attribute name} {type} {default option}>. If
    I do need to create a DTD, then how do I specify the element name in
    custom attributes declaration since the element itself is in SVG? For
    exampe, I would like to do this: <svg mynamespace:myattr="something">.

    Thanks a lot in advance.

    wz
    wzhang, Nov 14, 2003
    #1
    1. Advertising

  2. wzhang

    Micah Cowan Guest

    (wzhang) writes:

    > Hi,
    >
    > I would like to add some custom elements to svg files and also some
    > custom attributes to certain svg elements. Should I create a DTD to
    > include the cumtom elements and attributes?
    >
    > <!ATTLIST {element name} {attribute name} {type} {default option}>. If
    > I do need to create a DTD, then how do I specify the element name in
    > custom attributes declaration since the element itself is in SVG? For
    > exampe, I would like to do this: <svg mynamespace:myattr="something">.


    Take a look at the existing SVG dtd. The flat version is at:

    http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-flat.dtd

    The SVG DTD was designed specifically with extension in
    mind. All you have to do is make appropriate declarations in your
    internal DTD. Take, for instance, the <svg> element itself: it is defined
    by:

    <!ELEMENT %SVG.svg.qname; %SVG.svg.content; >

    The %SVG.svg.qname; is "svg", along with any appropriate prefix
    (which you can specify by defining %SVG.prefix;)

    The actual content is specified by the %SVG.svg.content;. This
    entity is defined to include another parameter entity,
    %SVG.svg.extra.content;. This is defined blank initially, and is
    available for you to specify in your internal DTD subset, e.g.:

    <!ENTITY % SVG.svg.extra.content "| foo">

    To indicate that svg can also contain a <foo/> element.

    Similarly, many of the attribute groups also allow extensions
    (AFAICT, most of the elements themselves don't allow direct
    attribute extension, since they mostly just use groups of shared
    attributes).

    For instance, to add to the Core Attributes an attribute that may
    be present in any element, you define %SVG.Core.extra.attrib; :

    <!ENTITY % SVG.Core.extra.attrib "foo CDATA #IMPLIED">

    For more info, read the flat DTD whose link I gave earlier, and
    the Extensibility section of the SVG spec:

    http://www.w3.org/TR/SVG11/extend.html

    HTH.

    --
    Micah J. Cowan
    Micah Cowan, Nov 18, 2003
    #2
    1. Advertising

  3. wzhang

    wzhang Guest

    Hi, Micah,

    Thank you for your reply. I did the internal DTD. But since I am going
    to use it in a lot of svg files, I would like to do it with an
    external DTD. Is there a way to do it?

    Thanks.

    wz

    Micah Cowan <> wrote in message news:<>...
    > (wzhang) writes:
    >
    > > Hi,
    > >
    > > I would like to add some custom elements to svg files and also some
    > > custom attributes to certain svg elements. Should I create a DTD to
    > > include the cumtom elements and attributes?
    > >
    > > <!ATTLIST {element name} {attribute name} {type} {default option}>. If
    > > I do need to create a DTD, then how do I specify the element name in
    > > custom attributes declaration since the element itself is in SVG? For
    > > exampe, I would like to do this: <svg mynamespace:myattr="something">.

    >
    > Take a look at the existing SVG dtd. The flat version is at:
    >
    > http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-flat.dtd
    >
    > The SVG DTD was designed specifically with extension in
    > mind. All you have to do is make appropriate declarations in your
    > internal DTD. Take, for instance, the <svg> element itself: it is defined
    > by:
    >
    > <!ELEMENT %SVG.svg.qname; %SVG.svg.content; >
    >
    > The %SVG.svg.qname; is "svg", along with any appropriate prefix
    > (which you can specify by defining %SVG.prefix;)
    >
    > The actual content is specified by the %SVG.svg.content;. This
    > entity is defined to include another parameter entity,
    > %SVG.svg.extra.content;. This is defined blank initially, and is
    > available for you to specify in your internal DTD subset, e.g.:
    >
    > <!ENTITY % SVG.svg.extra.content "| foo">
    >
    > To indicate that svg can also contain a <foo/> element.
    >
    > Similarly, many of the attribute groups also allow extensions
    > (AFAICT, most of the elements themselves don't allow direct
    > attribute extension, since they mostly just use groups of shared
    > attributes).
    >
    > For instance, to add to the Core Attributes an attribute that may
    > be present in any element, you define %SVG.Core.extra.attrib; :
    >
    > <!ENTITY % SVG.Core.extra.attrib "foo CDATA #IMPLIED">
    >
    > For more info, read the flat DTD whose link I gave earlier, and
    > the Extensibility section of the SVG spec:
    >
    > http://www.w3.org/TR/SVG11/extend.html
    >
    > HTH.
    wzhang, Nov 19, 2003
    #3
    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:
    339
    Joseph Tilian
    Dec 21, 2004
  2. Ronald Fischer
    Replies:
    4
    Views:
    1,743
    Ronald Fischer
    Mar 17, 2005
  3. thibault volpert

    dtd question

    thibault volpert, Jul 8, 2003, in forum: XML
    Replies:
    7
    Views:
    1,218
    thibault volpert
    Jul 15, 2003
  4. winderjj
    Replies:
    1
    Views:
    415
    Richard Tobin
    Jul 31, 2003
  5. test
    Replies:
    2
    Views:
    1,996
    Oliver Wong
    Jul 28, 2006
Loading...

Share This Page