DTD or schemas

Discussion in 'XML' started by David, Aug 26, 2003.

  1. David

    David Guest

    Sorry this might sound like a dumb question but what the difference
    between the two? Are they just two different ways of doing the same
    thing?

    I mean are the following two equilavent?

    <?xml version="1.0" encoding="UTF-8"?>
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
    elementFormDefault="qualified" attributeFormDefault="unqualified">
    <xs:element name="Day">
    <xs:complexType>
    <xs:sequence>
    <xs:element name="Bodypart" type="xs:string"/>
    <xs:element name="Excercise" type="xs:string"/>
    <xs:element name="Sets"type="xs:positiveInteger"/>
    <xs:element name="Reps" type="xs:positiveInteger"/>
    </xs:sequence>
    </xs:complexType>
    </xs:element>
    </xs:schema>



    <!DOCTYPE training [
    <!ELEMENT training (bodypart, excercise, sets, reps)>
    <!ELEMENT bodypart (#PCDATA)>
    <!ELEMENT excercise (#PCDATA)>
    <!ELEMENT sets (#PCDATA)>
    <!ELEMENT reps (#PCDATA)>
    ]>

    cheers!
     
    David, Aug 26, 2003
    #1
    1. Advertising

  2. David

    Bob Foster Guest

    No, they are two different ways of doing similiar things. Any document you
    can describe with a DTD can also be described with an XML Schema. The
    converse is not true. Just to scratch the surface, XML Schema adds
    namespaces, a limited form of interleave, type-specific uniqueness and key
    constraints and a plethora of simple datatypes more specific than CDATA or
    (#PCDATA).

    If you really want to learn about XML Schema, I recommend Priscilla
    Walmsley's book, Definitive XML Schema. It's the best.

    Bob

    "David" <> wrote in message
    news:...
    > Sorry this might sound like a dumb question but what the difference
    > between the two? Are they just two different ways of doing the same
    > thing?
    >
    > I mean are the following two equilavent?
    >
    > <?xml version="1.0" encoding="UTF-8"?>
    > <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
    > elementFormDefault="qualified" attributeFormDefault="unqualified">
    > <xs:element name="Day">
    > <xs:complexType>
    > <xs:sequence>
    > <xs:element name="Bodypart" type="xs:string"/>
    > <xs:element name="Excercise" type="xs:string"/>
    > <xs:element name="Sets"type="xs:positiveInteger"/>
    > <xs:element name="Reps" type="xs:positiveInteger"/>
    > </xs:sequence>
    > </xs:complexType>
    > </xs:element>
    > </xs:schema>
    >
    >
    >
    > <!DOCTYPE training [
    > <!ELEMENT training (bodypart, excercise, sets, reps)>
    > <!ELEMENT bodypart (#PCDATA)>
    > <!ELEMENT excercise (#PCDATA)>
    > <!ELEMENT sets (#PCDATA)>
    > <!ELEMENT reps (#PCDATA)>
    > ]>
    >
    > cheers!
     
    Bob Foster, Aug 27, 2003
    #2
    1. Advertising

  3. David <> wrote:

    > Subject: DTD or schemas


    > what the difference
    > between the two?



    One is optimized for humans and one is optimized for machines.

    One can express only a subset of what the other can express.


    --
    Tad McClellan SGML consulting
    Perl programming
    Fort Worth, Texas
     
    Tad McClellan, Aug 27, 2003
    #3
  4. David

    Bob Foster Guest

    "Tad McClellan" <> wrote in message
    news:...
    > David <> wrote:
    >
    > > Subject: DTD or schemas

    >
    > > what the difference
    > > between the two?

    >
    >
    > One is optimized for humans and one is optimized for machines.


    That's an interesting point of view. Which one do you think is optimized for
    humans? ;-}

    Bob Foster
     
    Bob Foster, Aug 27, 2003
    #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. Oleg Ogurok

    dynamic color schemas with ASP.NET

    Oleg Ogurok, Jun 8, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    465
    =?Utf-8?B?QmluIFNvbmcsIE1DUA==?=
    Jun 8, 2004
  2. Joseph Tilian
    Replies:
    0
    Views:
    380
    Joseph Tilian
    Dec 21, 2004
  3. Ronald Fischer
    Replies:
    4
    Views:
    1,809
    Ronald Fischer
    Mar 17, 2005
  4. IchBin

    Bookmark DTD or schemas

    IchBin, May 30, 2006, in forum: Java
    Replies:
    0
    Views:
    369
    IchBin
    May 30, 2006
  5. test
    Replies:
    2
    Views:
    2,192
    Oliver Wong
    Jul 28, 2006
Loading...

Share This Page