X-Schema

Paul Prescod paul at prescod.net
Mon Jun 28 00:48:41 BST 1999


"Hunter, David" wrote:
> 
> Don't get me wrong, I happen to like Schemas much better than DTDs, and the
> data typing alone makes them a better choice for many things.  I'm just
> wondering if we wouldn't be better off adding the extra functionality to
> DTDs, instead of creating a new language.  Are there technical reasons why
> we can't?  (Does it have something to do with SGML compatibility?  If so I'd
> be willing to shut up right now.  :-)

There are two major features that DTDs lack:

 * namespace support

 * some built-in form of subtyping

There is also the politically much more important feature of using XML
instance syntax.

Data types can be built as a convention on top of DTDs. That is, in part,
the point of XML's notation feature.

From: http://www.sgmlsource.com/ISOstds.PDF

<!NOTATION ISOdate SYSTEM "url of ISO date handler">
<!NOTATION ISOtime SYSTEM "url of ISO time handler">

<!ELEMENT record (date, time %record-stuff;)>

<!ELEMENT date (#PCDATA)>
<!ATTLIST date e-dtype NOTATION (ISOdate)#FIXED "ISOdate">

<!ELEMENT time (#PCDATA)>
<!ATTLIST time e-dtype NOTATION (ISOtime)#FIXED "ISOtime">

<record>
<date>17 November 1998</date>
<time>0543Z</time>
...
</record>

<!NOTATION ISOdate SYSTEM "url of ISO date handler">
<!NOTATION ISOtime SYSTEM "url of ISO time handler">
<!ELEMENT chapter (%chapter-stuff;)>
<!ATTLIST chapter a-dtypes CDATA #FIXED "date ISOdate time ISOtime"
	date CDATA #IMPLIED
	time CDATA #IMPLIED
>
<chapter date="17 November 1998" time="0543Z">

--

Recently SGML was also extended to do data types more directly:

<!ELEMENT chapter (%chapter-stuff;)>
<!ATTLIST chapter
date DATA regexp [model="[0-9]+-[0-9]+]" max="7"]#IMPLIED
>
<chapter date="12-97">


-- 
 Paul Prescod  - ISOGEN Consulting Engineer speaking for only himself
 http://itrc.uwaterloo.ca/~papresco

Perhaps the war in Kosovo would get more press if it were directed by
George Lucas.

xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev at ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ and on CD-ROM/ISBN 981-02-3594-1
To (un)subscribe, mailto:majordomo at ic.ac.uk the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo at ic.ac.uk the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa at ic.ac.uk)





More information about the Xml-dev mailing list