Validating Against a DTD
How do you really know if your XML document is valid? One way is to check it with an XML validator, and there are plenty out there to choose from. As explained in Chapter 1, validators are packages that will check your XML and give you feedback. For example, if you have the XML for Java parser from IBM's AlphaWorks installed, you can use the DOMWriter program as a complete XML validator. In Chapter 1, I created this document, greeting.xml:
<?xml version="1.0" encoding="UTF-8"?> <DOCUMENT> <GREETING> Hello From XML </GREETING> <MESSAGE> Welcome to the wild and woolly world of XML. </MESSAGE> </DOCUMENT>
I tested this document using DOMWriter (we'll see more about the command-line syntax required in Chapter 11, "Java ...
Get Inside XML now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.