Ian's books |
CPU Magazine
DTDs and Document Types
As described in the March 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 -- mar04.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. 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 -- This is the example document described in the article.
The document is valid against the included DTD.
(plain text version: data-1.txt)
-
data-1-invalid.xml --
Same example document as above, but a slightly different DTD -- this document is
invalid, as the DTD has no declaration for the h1 element.
(plain text version: data-1-invalid.txt)
-
data-2.xml --
The second example described in the article: this is also valid, but has a DTD
that restricts title elements to contain only text, and defined br elements to
be empty. The document contains two br elements -- one present as an empty-element
tag, and the other as a start/end tag sequence, with no white space between
the tags.
(plain text version: data-2.txt)
-
data-2-invalid.xml --
This is document is almost the same as data-2.xml: the DTD is identical. The only
difference is that the second br element (the one present as a start/end tag sequence)
has white space characters between the two tags. Some validation tools will accept
this as valid (e.g. any tool that uses the MSXML 4.0 XML parser), while others will
flag this document as invalid.
(plain text version: data-2-invalid.txt)
C) Some XML Editors with Validation Features
There are many commercial and open-source XML editors supporting validation. The first few listed here are
either free or available in short-term free trial versions (it's always nice to try before you buy!).
I've also included some links to other (longer) lists of XML editing tools.
-
XML Spy -- http://www.xmlspy.com --
This commercial editor uses its own internal XML parser. There is a free 30 day trial license available.
-
XRay -- http://www.architag.com/xray --
A simple (but free) XML editor that does real-time validation reporting (i.e. reports
validation errors as you type). Also uses the MSXML 4.0 parser.
-
<Oxygen/> -- http://www.oxygenxml.com --
Another commercial XML editor, written in Java, and uses the Xerces XML parser developed
as part of the Apache project. There is a free 30 day trial license available.
-
Topologi Collaborative Markup Editor -- http://www.topologi.com --
Another commercial XML editor, written in Java, that uses the Xerces XML parser (and several other
tools as well). There is a free trial version available for download.
-
XMLWriter -- http://xmlwriter.net --
A commercial XML editor from Wattle software. Let's you select which MSXML parser (4.x or 3.x)
to use. There is a free downloadable 30 day trial version.
-
XMetal -- http://www.corel.com/servlet/Satellite?pagename=Corel/Products/productInfo&id=1042152754863 --
A commercial XML editor from Corel Corp. (originally a SoftQuad -- Corel purchased SoftQuad in 2002).
Apparently a nice tool, but I haven't tried it recently (there is no free trial download).
-
Epic (formerly Adept Editor) -- http://www.arbortext.com/html/products.html --
A commercial XML editor from Arbortext, based on a solid SGML core (Arbortext was an important player
in the early days of SGML and XML). It's pretty expensive, and targeted at large-scale document management
environments (there is no free trial download).
-
XML Software list of editors -- http://www.xmlsoftware.com/editors.html
-- A long and relatively up-to-date list of XML editors.