newbie: xsd or dtd?

A

Andreas

I am just working my way through the different XML manuals and am stuck on
the decision whether to use a DTD or an XSD. From what I gather both do
similar things, with the exception that the XSD is XML based, while a DTD
isn't.

Most sources I found use DTDs and personally I find it easier to understand,
but I'd just like to hear your opinions.

Thanks again.
 
M

Malte

Andreas said:
I am just working my way through the different XML manuals and am stuck on
the decision whether to use a DTD or an XSD. From what I gather both do
similar things, with the exception that the XSD is XML based, while a DTD
isn't.

Most sources I found use DTDs and personally I find it easier to understand,
but I'd just like to hear your opinions.

Thanks again.
I understand that xsd is the modern way of doing dtd.
 
?

=?ISO-8859-1?Q?J=FCrgen_Kahrs?=

Malte said:
I understand that xsd is the modern way of doing dtd.

Yes, the Schema language (with file names ending in xsd)
is much more modern than the DTD language. When deciding
which way to go, you should also consider these points:

- DTD is an established standard (used for about 20 years)
- Schema is an unestablished standard (since 1999)
- Schema seems to have fallen out of favour by its creators
- Schema looks obsolete when its creator push an alternative
 
S

Steve W. Jackson

Jürgen Kahrs said:
Yes, the Schema language (with file names ending in xsd)
is much more modern than the DTD language. When deciding
which way to go, you should also consider these points:

- DTD is an established standard (used for about 20 years)
- Schema is an unestablished standard (since 1999)
- Schema seems to have fallen out of favour by its creators
- Schema looks obsolete when its creator push an alternative

How is XML Schema to be considered an "unestablished standard" when the
W3C published it as a recommendation in 2001? And if it's fallen out of
favor, why is W3C currently working on XML Schema 1.1? Please do
enlighten me.

= Steve =
 
?

=?ISO-8859-1?Q?J=FCrgen_Kahrs?=

Steve said:
How is XML Schema to be considered an "unestablished standard" when the
W3C published it as a recommendation in 2001?

Even a W3C recommendation needs the blessing of
the real-world practitioners. I have received
email from many developers who go on writing
DTDs, ignoring Schema.
And if it's fallen out of
favor, why is W3C currently working on XML Schema 1.1? Please do
enlighten me.

I don't know why they do it. But this is not my point.
Maybe they love to tinker with dead standards.
Some kind of necrophily (in a strictly Platonic sense
of course).

Let's look at what the W3C people do in real life.
When specifying XHTMl2, they used Relax NG instead
of Schema:

http://lists.w3.org/Archives/Public/public-rdf-in-xhtml-tf/2003Jun/0023.html
We've already normatively adopted RELAX NG for XHTML 2.0, partly because
RDF/XML was only defined in RELAX NG.

When these people use the word "Schema", they write it "schema",
meaning that there is a whole class of schema languages.

http://www.stylusstudio.com/xmldev/200312/post90200.html

In this tutorial you will learn how to use the RELAX NG schema
language, an alternative schema language for XML.
[..]
Once RELAX NG's concepts have crossed the blood-brain barrier,
you will never be able to take any other schema language quite
seriously again.
 
M

Malte

Jürgen Kahrs said:
Yes, the Schema language (with file names ending in xsd)
is much more modern than the DTD language. When deciding
which way to go, you should also consider these points:

- DTD is an established standard (used for about 20 years)
- Schema is an unestablished standard (since 1999)
- Schema seems to have fallen out of favour by its creators
- Schema looks obsolete when its creator push an alternative

I am not afforded the privilege of being able to chose. ALL my customers
want xsd, not dtd.

I also do not hold a grudge against any of those technologies. Just
basically do what I am paid to do.
 
P

Peter Flynn

Andreas said:
I am just working my way through the different XML manuals and am stuck on
the decision whether to use a DTD or an XSD. From what I gather both do
similar things, with the exception that the XSD is XML based, while a DTD
isn't.

Not quite. They are both XML. DTDs are written in XML Declaration Syntax
whereas W3C Schemas are written in XML Document Syntax.
Most sources I found use DTDs and personally I find it easier to
understand, but I'd just like to hear your opinions.

DTDs are easier to understand and write but are designed for text documents,
so they have almost no facilities for data validation. W3C Schemas were
designed for data, not text, and have extensive content validation features.
So it depends on what type of application you are dealing with.

///Peter
 
?

=?ISO-8859-1?Q?J=FCrgen_Kahrs?=

Peter said:
Not quite. They are both XML. DTDs are written in XML Declaration Syntax
whereas W3C Schemas are written in XML Document Syntax.

A file containing a DTD cannot be parsed with an XML parser.
A file containing a Schema can be parsed with an XML parser.
That's what he meant.
 
T

Tjerk Wolterink

Andreas said:
I am just working my way through the different XML manuals and am stuck on
the decision whether to use a DTD or an XSD. From what I gather both do
similar things, with the exception that the XSD is XML based, while a DTD
isn't.

Most sources I found use DTDs and personally I find it easier to understand,
but I'd just like to hear your opinions.

Thanks again.

XSD is more powerfull tha DTD, so i would choose XSD. And you dont need to learn a new syntax,
it is just simple xml.
 
S

Steve Slatcher

Jürgen Kahrs said:
A file containing a DTD cannot be parsed with an XML parser.

ITYM you cannot the access the contents of the DTD through APIs such as DOM
or SAX.

A somewhat less pendantic point to consider is that if you need to define
you own entities you will need a DTD.
 
D

David Carlisle

A file containing a DTD cannot be parsed with an XML parser.
A file containing a Schema can be parsed with an XML parser.
That's what he meant.

I know what you mean, but as written that isn't true.
The largest part of the XML recommendation is taken up defining how an
XML parser should parse DTD syntax. I know of no other tools other than
an XML parser (or SGML parser) that _can_ parse DTD syntax.

David
 
?

=?ISO-8859-1?Q?J=FCrgen_Kahrs?=

David said:
A file containing a DTD cannot be parsed with an XML parser.
A file containing a Schema can be parsed with an XML parser.
That's what he meant.

I know what you mean, but as written that isn't true.

OK, you know what I mean. This is a sober newsgroup
and we don't start flame wars about misunderstandings.
Schema files can be parsed with the usual XML tools.
From the viewpoint of a tool-writer, this is one of
the advantages of Schema when compared to DTD.
The largest part of the XML recommendation is taken up defining how an
XML parser should parse DTD syntax. I know of no other tools other than
an XML parser (or SGML parser) that _can_ parse DTD syntax.

Really ?

DTD parsers
http://www.garshol.priv.no/download/xmltools/cat_ix.html#SC_DTDParser

I wish that DTDs were "XML-compatible".
Then some tools would become much easier to implement.
 
P

Peter Flynn

Jürgen Kahrs said:
A file containing a DTD cannot be parsed with an XML parser.
A file containing a Schema can be parsed with an XML parser.
That's what he meant.

A file referencing a DTD cannot be parsed by a 'well-formedness' XML parser.
It can of course be parsed by a validating XML parser (eg onsgmls).
The idea that DTDs are somehow "not XML" is completely false.

///Peter
 
P

Peter Flynn

Steve said:
ITYM you cannot the access the contents of the DTD through APIs such as
DOM or SAX.

Yes, this has always bugged me: it's a completely unnecessary restriction.
Even back in the days of SGML I wanted to do this, and I was unable to
persuade the authors of several parsers, even James Clark, that I was being
serious. There's something about document engineering that computer
scientists and programmers just don't get.

(Actually there are ways around it, fortunately.)

///Peter
 
P

Peter Flynn

Jürgen Kahrs said:
OK, you know what I mean. This is a sober newsgroup
and we don't start flame wars about misunderstandings.
Schema files can be parsed with the usual XML tools.

My "usual XML tools" include a validating parser and a number of other
programs which have no problem (read: are designed for) handling DTDs.
I think you are referring to the XML tools used by Schema-only users.
From the viewpoint of a tool-writer, this is one of
the advantages of Schemas when compared to DTDs.

Yes, absolutely. The drawbacks are passed to the user, who has to deal
with (in the case of W3C Schemas) the need for verbosity and a lack of
declarable entities, but these are a small price to pay for the benefit
of data-level validation and the sharing of document-instance code.

Yes really. David could also have phrased it the other way round: an
XML parser (actually, a validating parser) is a program that can read
DTD syntax. That's what one is.
I wish that DTDs were "XML-compatible".
Then some tools would become much easier to implement.

Programmers whinge about this all the time. I suggest they go and look
at the code for onsgmls and borrow what they need of it. I am reliably
informed that this is not rocket science (or if it is, I know any number
of unemployed rocket scientists who can do it for you :)

///Peter
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top