[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Just a doubt...

  • From: Ronald Bourret <rbourret@i...>
  • To: "xml-dev@i..." <xml-dev@i...>
  • Date: Thu, 7 Jan 1999 10:33:36 +0100

writing xml dtds
Cesar Bonavides M. wrote:

> To make it simple:
>   I already read the XML, XLink, XPointer and XSL stuff, but that thing
> about XML-data and XML-schemas really did confuse me.

Currently, the legal format of an XML file is defined in a DTD.  For 
example, the following DTD defines XML documents in which a Memo element 
contains one or more Paragraph elements and a Paragraph element contains 
parsed character data:

<!ELEMENT Memo (Paragraph+)>
<!ELEMENT Paragraph (#PCDATA)>

XML schema languages are an attempt to replace DTDs.  That is, they are XML 
languages used to defined other XML languages.  For example, the DTD shown 
above can be defined in XML-Data as:

<schema>
   <elementType id="Memo">
      <element type="#Paragraph" occurs="ONEORMORE"/>
   </elementType>
   <elementType id="Paragraph">
      <string/>
   </elementType>
</schema>

There are two main reasons to do this.  The first reason is that DTDs are 
restricted by the XML 1.0 requirement that XML be compatible with SGML. 
 Thus, DTDs cannot be extended in ways that are incompatible with SGML 
DTDs.  However, schema languages are not restricted and can therefore be 
extended in new ways, such as data typing of elements.

The second reason is more practical in nature.  Because many people write 
XML documents but few people write XML DTDs, many more tools and 
technologies are available for XML documents than for XML DTDs.  Because 
schema languages use XML document syntax, they can use the tools and 
technologies designed for XML documents.

As a simple example, suppose you are writing an XML editor and you want to 
use DTDs to control user input -- for example, if somebody is editing a 
memo that conforms to the above DTD, you want to be sure that the Memo 
element contains Paragraph elements but not other Memo elements.  Because 
most XML parsers do not return DTD information to the application, you 
would need to write your own DTD parser.  However, if your document schemas 
were defined using a schema language instead of DTDs, you could parse the 
schema documents using any available XML parser.

There are currently four proposed schema languages:

XML-Data:	http://www.w3.org/TR/1998/NOTE-XML-data
XSchema:	http://www.simonstl.com/xschema/spec/xscspecv6.htm
DCD:		http://www.w3.org/TR/NOTE-dcd
SOX:		http://www.w3.org/TR/NOTE-SOX/

All of these languages are very similar at a base level -- defining 
elements and attributes and so on. They differ to some extent in the degree 
to which they replace DTDs; for example, some can define entities and some 
can't.  They differ radically in the other capabilities they offer: 
XML-Data is the most ambitious and XSchema is the simplest.  Eventually, 
all of these languages will be replaced by one currently being defined by 
the W3C.

Since you are just starting out with XML, you might not need to worry about 
schema languages.  If you are still interested, I suggest starting with 
XSchema, as I think it is the simplest (disclaimer: I am one of the authors 
and admittedly biased).  A couple of other things to consider:
(a) XML-Data is (I believe) no longer being worked on, but is used by the 
Microsoft parser as a way to expose DTD information.
(b) You will probably want to convert any code you write to the W3C's 
schema language when it is published, so it might be safest to stick with 
the basics.

-- Ron Bourret


xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev@i...
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/
To (un)subscribe, mailto:majordomo@i... the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo@i... the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa@i...)


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.