ment needed to be defined (i.e. letter, date, address, greeting, etc.). For example, type <!ELEMENT para ()> for the paragraph element between the square brackets.
For each element define its content by listing either other element names or #PCDATA, de- pending on how the XML file is structured. Don't forget to append either a plus sign (+), an asterisk (*), or a question mark (?) to denote the number of times an element or list of ele- ments may appear in the XML file.
Select and copy the entire contents of ala.xml to the clipboard.
Open your Web browser, and validate your XML file by using a validation form [http://www.stg.brown.edu/service/xmlvalid/] .
Document type definitions
Exercise - Validating against a system DTD
In this exercise you will use xmllint to validate a locally defined (system) DTD. While using a remote service such as the one mentioned above is easy, it really behooves you to be more self-reliant than that.
Install xmllint. Xmllint is a validation program written against a set of C libraries called libxml2 and libxslt. Installing these libraries on Unix follows the normal installation processes: download, unzip, untar, configure, make, and install. On Windows is it much easier to download the pre- compiled binaries making sure you download the necessary .dll files. All of these files have been saved in a directory on the CD called libxml. Simply copy this directory to your C drive and/or add the libxml directory to your PATH environment variable. Once done you should be able to enter xmllint and xsltproc from the command line and see lot's of help text.
Open a command prompt and change directories to the getting-started directory of the workshop's distribution.
Validate letter.xml against letter.dtd using this command: xmllint --dtdvalid letter.dtd letter.xml . If everything goes well you should see a stream of XML without any errors. If you want to repress the stream of XML then add --noout: xmllint --noout --dtdvalid letter.dtd letter.xml .
To good to be true? Change something about letter.xml to make it invalid, and try validating it again to demonstrate that xmllint is working correctly.
Exercise - Fixing an XML document by hand
If you have not had the joy of trying to fix an XML file based on the output of xmllint, then here is your chance. In this exercise you will make an XML document validate against a DTD.
Browse the content of the directory xml-data/ead/broken/. It contains sets of well-formed XML documents that validated against an older version of an EAD (Encoded Archival Description) DTD.
Open an EAD file in your favorite text editor, say ncw.xml. Notice its structure. At first glance, es- pecially to the uninitiated, the file seems innocuous.
Open a command prompt and change directories to the root of the workshop's distribtuion.