Ian's books |
CPU Magazine
DTDs Part 3: Features and Limitations
As described in the May 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 -- may04.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 for validity automatically as the file is loaded, while others will require
that you select to validate.
- data-1.xml : (plain text version: data-1.txt)
Example document and DTD, which has multiple declarations for entities (including a
definition in the external subset) and attributes. The document is valid.
External Entity-- things.xml (plain text version: things.txt)
External Subset-- stuff.dtd (plain text version: stuff.txt)
- data-1-a.xml : (plain text version: data-1-a.txt)
The DTD is the same as for data-1.xml
, but the document is invalid because it
contains <h2 align="center">
, and the DTD says the only allowed values for
align
are "left"
or "right"
.
- data-2.xml -- (plain text version: data-2.txt)
This document is a simplified version of data-1.xml (there are no entity declarations), but references
an external subset having an element declaration for the section
element. But the
internal subset also has a declaration for the section
element, so the document
is invalid.
External Entity-- ext-subset.dtd (plain text version: ext-subset.txt)
C) Some XML Editors with Validation Features
See the listing provided in the March 2004 article (http://www.iangraham.org/writing/cpu-articles/mar04/).