DTD vs. schema?

Discussion in 'XML' started by D. Alvarado, Apr 15, 2004.

  1. D. Alvarado

    D. Alvarado Guest

    Hello,
    I am sort of new to all this XML, but I would like to enforce a
    date format within one of my XML elements. Everything I've read
    indicates that a DTD is not suitable for this purposes, so I should
    use a schema. In as far as this seems to be the only limitation of a
    DTD, are there any disadvantages to using a schema? Or should I just
    use a DTD and have a little extra programming to verify valid date
    formats (which seems to defeat the purpose of XML)?

    Thanks for any advice anyone can provide, Dave
    D. Alvarado, Apr 15, 2004
    #1
    1. Advertising

  2. D. Alvarado

    Ashmodai Guest

    D. Alvarado scribbled something along the lines of:

    > Hello,
    > I am sort of new to all this XML, but I would like to enforce a
    > date format within one of my XML elements. Everything I've read
    > indicates that a DTD is not suitable for this purposes, so I should
    > use a schema. In as far as this seems to be the only limitation of a
    > DTD, are there any disadvantages to using a schema? Or should I just
    > use a DTD and have a little extra programming to verify valid date
    > formats (which seems to defeat the purpose of XML)?
    >
    > Thanks for any advice anyone can provide, Dave


    You can't use the W3C Validator any longer if you use Schema instead of
    a DTD, but if your text editor can do that or you care to search for a
    schema based validator, even that shouldn't be an issue.

    Read a little about RELAX NG and W3C's XML Schema, then decide which
    suits you most. I think there's other schemas as well, but those are the
    only ones I can think of right now.
    You should be able to find the XML Schema recommendation in the XML
    section of the W3C website [1] and the RELAX NG spec should be somewhere
    at OASIS [2].

    [1] http://www.w3.org
    [2] http://www.oasis-open.org
    --
    Alan Plum, WAD/WD, Mushroom Cloud Productions
    http://www.mushroom-cloud.com/
    Ashmodai, Apr 16, 2004
    #2
    1. Advertising

  3. D. Alvarado wrote:

    > I am sort of new to all this XML, but I would like to enforce a
    > date format within one of my XML elements. Everything I've read
    > indicates that a DTD is not suitable for this purposes, so I should
    > use a schema. In as far as this seems to be the only limitation of a
    > DTD, are there any disadvantages to using a schema? Or should I just
    > use a DTD and have a little extra programming to verify valid date
    > formats (which seems to defeat the purpose of XML)?


    If you want to use a schema you need a parser that understands schemas
    and can validate against schemas and schema validation is more complex
    than DTD validation. However by now there are many parsers with schema
    support, look at http://xml.apache.org/ for the Xerces C++ and the
    Xerces Java solution for instance, or on Windows MSXML 4 is an option.

    --

    Martin Honnen
    http://JavaScript.FAQTs.com/
    Martin Honnen, Apr 16, 2004
    #3
  4. D. Alvarado

    GIMME Guest

    It's been a while since I experimented with it but ...

    You can use a DTD if you opt to have the data be an attribute
    instead of an element.


    (D. Alvarado) wrote in message news:<>...
    > Hello,
    > I am sort of new to all this XML, but I would like to enforce a
    > date format within one of my XML elements. Everything I've read
    > indicates that a DTD is not suitable for this purposes, so I should
    > use a schema. In as far as this seems to be the only limitation of a
    > DTD, are there any disadvantages to using a schema? Or should I just
    > use a DTD and have a little extra programming to verify valid date
    > formats (which seems to defeat the purpose of XML)?
    >
    > Thanks for any advice anyone can provide, Dave
    GIMME, Apr 16, 2004
    #4
    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,742
    Ronald Fischer
    Mar 17, 2005
  3. Markus
    Replies:
    1
    Views:
    1,497
    Markus
    Nov 23, 2005
  4. Stanimir Stamenkov
    Replies:
    3
    Views:
    1,170
    Stanimir Stamenkov
    Apr 25, 2005
  5. pramodr
    Replies:
    3
    Views:
    830
    Peter Flynn
    Apr 5, 2009
Loading...

Share This Page