Support for DOM and other external tree models
Support for the namespace axis has been reinstated in JDOM. This underpins functions such
as get-in-scope-prefixes
, and ensures that namespaces are properly copied by
xsl:copy-of
. {axes-jdom049, 055, 129 etc}
For ease of testing, a new command line interface net.sf.saxon.jdom.JDOMTransform
has
been added. The arguments are exactly the same as the normal net.sf.saxon.Transform
command.
The constructor for class jdom.NodeWrapper
has been made protected. A new wrap() method
has been supplied on the jdom.DocumentWrapper class, allowing any node in the document to be wrapped,
provided that the document node has been wrapped.
Whitespace stripping should now work for JDOM input in the same way as for other tree models (see below).
A set of DOM wrapper classes have been written, analogous to the JDOM wrapper classes. {axes-dom[001-nnn]}
The DOM wrapper has been tested with the Crimson DOM provided in JDK 1.4 and with Xerces 2.5.0. Different DOM implementations are known to vary widely. Saxon's DOM interface does not attempt to deal with entity reference nodes, which appears to be OK with the default configuration of these two parsers. CDATA sections are treated as text nodes, no attempt is made to merge them with adjacent text nodes.
The DOM interface is very inefficient, for example it has to resolve namespace prefixes by searching the namespace declarations every time a node is referenced. Don't use it if performance matters to you.
I have changed the code for writing output to a DOMResult so that it now uses DOM level 2 interfaces
Document#createElementNS()
and Element#setAttributeNS()
. As a result, it should
now be possible to use methods such as getPrefix
and getNamespaceURI
on these
nodes.