Abstract
XMLUtil provides a set of easy-to-used apis to retrieve data from XML document. By using XMLUtil, you can:
- construct XMLUtil object from XML file name, or an XML element;
- retrieve an element's String value by passing a directory-like node path;
- retrieve a set of sibling nodes into Vector;
- retrieve a set of sibling nodes into Hashtable, hash key is attribute value;
- and much more.
XMLUtil has been extensively used in two open-sourced projects, jtestcase and xtype.
Properties
The behaviour of XMLUtil can be controlled via a couple of system properties. These properties can be set by
providing a -D argument to the VM or by using System.setProperty() in your application.
- xmlutil.script.validation:
If set to "false" this property turns off the validation of XML documents against their schema during load in the class
XMLUtil. Attention: This property does not turn off validation in the class XMLValidator (which would make no sense,
because this is the only purposeof this class). The default is "true".
- xmlutil.validate.dom:
If set to "true" the validation in the class XMLValidator is done with the DOM parser. If set to "false" the SAX parser
is used. The default is "false".
- xmlutil.parser.version:
This property is only needed if a Xerces2 parser should be used. In this case this property
has to be set to "Xerces2" to get the schema validation to work.
Software prerequisites
- XML Parser: Xerces version 1.4.1 or above that is XML Schema enabled (see properties section
for details on Xerces2 parsers).