Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > DTD or schemas

Reply
Thread Tools

DTD or schemas

 
 
David
Guest
Posts: n/a
 
      08-26-2003
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 xmlnss="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="xsositiveInteger"/>
<xs:element name="Reps" type="xsositiveInteger"/>
</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!
 
Reply With Quote
 
 
 
 
Bob Foster
Guest
Posts: n/a
 
      08-26-2003
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) om...
> 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 xmlnss="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="xsositiveInteger"/>
> <xs:element name="Reps" type="xsositiveInteger"/>
> </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!



 
Reply With Quote
 
 
 
 
Tad McClellan
Guest
Posts: n/a
 
      08-26-2003
David <(E-Mail Removed)> 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
http://www.velocityreviews.com/forums/(E-Mail Removed) Perl programming
Fort Worth, Texas
 
Reply With Quote
 
Bob Foster
Guest
Posts: n/a
 
      08-27-2003
"Tad McClellan" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> David <(E-Mail Removed)> 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


 
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
Bookmark DTD or schemas IchBin Java 0 05-30-2006 07:10 PM
How to specify DTD to DTD.getDTD for DocumentParser? Ronald Fischer Java 4 03-17-2005 09:37 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