XML:Wrench :: How-To check XML files


It's important that XML files are syntactically correct. This is rather different from HTML, where by and large web browsers would tolerate a measure of badly formed code.

The checks on an XML file work at two levels:

Well-formed

A well-formed XML document is one that matches the basic specifications for any XML file. This means that all tags starting with a < must have a matching >. Further any attributes within the opening tag element must be quoted either with " or '.

Also, the open and closing elements must match. When a close tag is encountered it must hold the same text value as the most recent start tag. XML is case sensitive, so open and close tags must be in the same case.

To check a document is well-formed click on the well-formed button or select it from the Tools menu. if the document is well-formed you get a short message saying OK. Otherwise XML:Wrench will display an error mesage and move the edit cursor to the line containing the error.


Valid

A valid XML document is one that is well-formed and also matches criteria laid out in a Document type definition. This is typically spcified in a DTD file referenced at the top of the XML file. If the XML does not contain DocType information or a DTD then there is no difference between a check for well-formed and a check for validity.

To check a document is valid, click on the valid button or select it from the Tools menu. if the document is valid you get a short message saying OK. Otherwise XML:Wrench will display an error mesage and move the edit cursor to the line containing the error.

There is no need to check both well-formed and valid. If a document is valid then it must also be well-formed.