Ian's books |
CPU Magazine
DTDs Part 2: Attributes
As described in the April 2004 issue of
CPU - Computer Power User
magazine.
Examples
A) Downloadable ZIP File
-
There are several examples here -- why not download the whole lot
as a ZIP file -- apr04.zip -- and install
them on your own machine?
B) The example XML documents
To play with these documents, simply load them into an XML editor and test them
for validity, or load them into a browser and view the results. Some editors will
test automatically as the file is loaded, while others will require that you select
to validate.
- data-1.xml --
Example document and DTD -- The DTD declares default values for the lang and dir
attributes of the div element. The DTD completely specifies the elements and content
model, and so the document should validate against the DTD.
(plain text version: data-1.txt)
- data-2.xml --
Example document and DTD -- Similar to data-1.xml, except taht there are no element declarations
for the p and div elements. Default values for attributes will be assigned to the div
elements, but the document will not validate due to the missing declarations.
(plain text version: data-2.txt)
C) Some XML Editors with Validation Features
See the listing provided in last month's article (http://www.iangraham.org/writing/cpu-articles/mar04/index.html).