xslt2.0 mode
Feeding an oracle.xml.parser.v2.XMLElement
(implements org.w3c.org.w3c.dom.Element)
as Source causes under certain xsl:function evaluations
nullpointer exceptions. The reason is that the oracle
DOM (at toplevel?) null returns at getParent().
My fix is preventing dereferencing null pointers at:
net.sf.saxon.dom.NodeWrapper.isSameNode()
public boolean isSameNode(NodeInfo other) { // DOM does not offer any guarantees that the
same node is always represented
// by the same object
if (other == null || !(other instanceof
NodeWrapper)) {
return false;
}
NodeWrapper ow = (NodeWrapper)other;
if (getSiblingPosition()!=ow.getSiblingPosition()) {
return false;
}
// start patch
if (ow.getParent() == null) {
return getParent() == null;
}
if (getParent() == null) {
return false;
}
return getParent().isSameNode(ow.getParent());
// end patch
}
cheers
- Jurgen
Michael Kay
2004-09-17
Logged In: YES
user_id=251681
Thanks. I have in fact rewritten this method for Saxon 8.1.
My fix for the problem is a little more radical: I try to
prevent the situation occurring that a DOMSource wraps a
node in a tree whose root is not a document node. This is
because all the administrative data associated with the tree
in Saxon is held with the document node, and there are lots
of things in the code that make the assumption that the root
will be a document. Support for non-Document trees may be
added at some time, but I think it needs more than this fix.
Incidentally, the method is renamed isSameNodeInfo() in 8.1
to avoid conflict with the DOM level 3 method of the same
name. I'm not actually supporting DOM level 3 yet - when I
do, it will be possible to implement isSameNodeInfo() by
calling isSameNode() on the underlying DOM nodes.
Michael Kay