Concluding Thoughts on DTDs




Download 2,96 Mb.
Pdf ko'rish
bet90/131
Sana14.05.2024
Hajmi2,96 Mb.
#232039
1   ...   86   87   88   89   90   91   92   93   ...   131
Bog'liq
Ceponkus, Hoodbhoy - Applied XML - Toolkit for Programmers

Concluding Thoughts on DTDs
We’ve gone through a lot of details about the guts of an XML document and stressed a 
lot on how to create DTDs to ensure structural integrity of your XML documents. Using 
DTDs you can define even fairly complex structures with the syntax we’ve described.
However, DTDs leave a lot to be desired. They are not terribly intuitive, nor are they 
particularly easy to use. Even more important than the niceties of convenience, DTDs 
have a serious deficiency in that they do not address datatyping, which is constraining 
data to a particular format such as an integer, floating point, or date. Furthermore, it does 
not allow you to limit the number of entries (sure, you can specify “zero,” “zero or more,” 
and “one or more” instances, but you cannot specify “let only 2 occurrences happen” or 
“let there be less than 10 occurrences”).
More often than not, as a programmer, you are going to want more control of your 
datatyping. String information (#PCDATA and CDATA), while useful, usually requires 
further processing before you can do anything interesting such as calculations with it. The 
result is that you end up having to do a lot of grunt programming to make things happen, 
which is pretty ridiculous when you think about it—just about every programming 
language gives you the ability to datatype your variables. If XML is going to succeed in 


- 95 -
being the universal way of representing and exchanging information over the Web, 
datatyping is critical.
The W3C is aware of this very basic need and has a working group called the XML 
Schema Working Group. According to its Web site, it is currently working on creating a 
formal recommendation; however several proposals have been submitted to the group. 
The current proposals listed include the XML-Data proposal submitted by representatives 
from Microsoft, Inso Corporation, DataChannel, ArborText, and the University of 
Edinburgh.
The reason we mention this proposal is that Microsoft has included complete support of 
this proposal, which was later included as a subset to the Document Content Description 
proposal in August of 1998, in Internet Explorer 5. However, because this is NOT 
currently a W3C approved recommendation, we do not spend a lot of time writing about 
how to use it. Nevertheless, we do encourage you to take a look at it and perhaps write 
some sample code around it. It’s neat and it gives you an idea of what alternative content 
description syntaxes to DTDs might look like. You can get details on the current 
proposals under consideration at the W3C’s XML Schema Working Group at 
www.w3.org/XML/Activity.html
.

Download 2,96 Mb.
1   ...   86   87   88   89   90   91   92   93   ...   131




Download 2,96 Mb.
Pdf ko'rish