The Document Object Model (DOM) provides a standard interface for interacting
with XML documents. Xalan-Java supports this interface. For large XML documents, however, this may involve considerable
overhead, since Xalan-Java must create one or more Java objects for each Node in the document DOM tree.
For the majority of cases -- your input and output are URLs, files, or streams, and you use the default Liaison
(DTMLiaison class) and XML parser -- Xalan-Java avoids this overhead by implementing the Document Table
Model (DTM), a "pseudo-DOM" that uses integer arrays in place of the DOM. For larger input and output trees, the
performance improvements can be very significant.
The XSLTProcessorFactory static getProcessor() method sets up an XSLT processor to use the default DTM liaison
and XML parser. If your input or output turns out to be a DOM Node, the XSLTProcessor automatically switches to the
XercesLiaison class and the Xerces DOM parser. You can explicitly instantiate an XSLTProcessor to use
XercesLiaison and the Xerces DOM parser as follows:
org.apache.xalan.xslt.XSLTProcessor xsltProc = org.apache.xalan.xslt.XSLTProcessorFactory.getProcessor(
new org.apache.xalan.xpath.xdom.XercesLiaison());
For more information, see Processing DOM input and Producing DOM
output.
| The DTM parser always attempts to expand eentityreferences in the source tree and stylesheet
tree. If you attempt to turn off entity reference expansion -- with DTMLiaison
setShouldExpandEntitityRefs(false) -- DDTMLiaisondoes not make the setting and issues a message to that
effect. If you want to turn off entity rreferenceexpansion, instantiate the XSLTProcessor to use XercesLiaison and the
Xerces DOM parser. |