Lists Home |
Date Index |
>First of all, the XML specification,
>http://www.w3.org/TR/2000/REC-xml-20001006, not only dictates the XML syntax,
>but also includes the DTD language. Put it in another way; the spec is XML
>syntax plus a schema language. Is that a correct interpretation/perspective?
It's not wrong, but it lacks historical perspective.
XML is a subset of SGML, which didn't separate well-formedness and
validity. XML separated them, and more recently there have been other
schema languages invented.
>My conclusions from this reasoning, which surely can be wrong, is that for
>example a XHTML document which looks like this:
><?xml version="1.0" encoding="UTF-8" ?>
>is _not_ valid XML, because it doesn't have a DOCTYPE thingy.
>In other words, the XML specification ties the term "validness" to a
>particular syntax, the DTD schema language. It's not an abstract term which
>means "conforms to a model of the XML format", such that any schema language
>can be used to "define" validness.
Just so. When the XML spec was written, there were no other schema
languages for XML.
>But does it matter if a document is Not valid?
Not necessarily. It's up to you. Requiring a document to be valid is
a way of putting some constraints on it. If you don't have any such
constraints (unlikely, unless you are writing some very generic
software like an editor), then there's no need for validity. More
likely, not all your constraints can be expressed by a DTD, and you
will need to express them some other way.
And of course you can require the document to be valid according to
some other kind of schema, such as XML schemas or RelaxNG or
What "valid" means depends on context. In the context of plain XML,
it means valid according to a DTD. If there is ambiguity, use a term
like "DTD-valid" instead.
>The DTD specifies the logical structure, but also identifies /what/ type of
>document it is, e.g. the public identifier. But isn't XML namespaces for
>this? When the XHTML namespace is declared in the xhtml element, wouldn't
>that be enough?
Again, this lacks historical perspective. XML namespaces were invented
after XML itself.
But even now that we have namespaces, a document using a given
namespace might conform to more than one DTD or schema. Even your
example, XHTML, has "strict" and "transitional" DTDs. New versions of
vocabularies may find it inconvenient to use a new namespace
(e.g. XSLT). Or a vocabulary may be very general, and you may use
DTDs to require subsets of it.