Classes used to simplify manipulation of XML documents, including
parsing, programmatic creation, and serialization.
Author
|
Eric
Faulhaber |
Date
|
June
14, 2007
|
Access Control
|
CONFIDENTIAL
|
Contents
Introduction
Dependencies
TODOs
Introduction
This package contains classes which provide simplified access to XML
documents using the Document Object Model (DOM) idiom.
Transformation between DOM objects and AST representations is
supported. XML Document objects can originate from various
sources:
- parsed from an XML document in the file system or a
character stream, using an XML parser;
- dynamically built in memory using the
org.w3c.dom
package;
- transformed from an AST.
Once in memory a DOM can be:
- serialized to a file or character stream, either formatted
(pretty printed), or unformatted (no additional whitespace);
- transformed into an AST.
Dependencies
This package has dependencies on the following J2SE packages:
- javax.xml.parsers
- javax.xml.transform
- javax.xml.transform.dom
- javax.xml.transform.stream
- org.w3c.dom
The current implementation uses only public APIs within these packages,
however, there is one vendor specific dependency introduced when
porting this package to Java Standard Edition 6. Namely, the XmlHelper.write(Document
dom, Writer writer, boolean pretty)
method
currently relies upon the Apache Xalan XSLT processor for formating
support when performing pretty printing. Specifically, we
pass an output property of "{http://xml.apache.org/xslt}indent-amount
"
(a Xalan-specific extension) to the Transformer
class when serializing a DOM to an output stream. The
intention is to remove this dependency in a future implementation,
which will insulate us from changes to the underlying XSLT
implementation, should this change in future Java versions.
TODOs
- Remove the Xalan XSLT processor dependency for pretty
printing.
- Invent a mechanism for tracking line and column numbers for
XML documents, as well as source file names for those documents which
originate from the file system. This would be very helpful
for providing more useful diagnostic information when reporting TRPL
errors and warnings.
- Add logging.