NullPtrException using DOMSource
The Saxon XSLT and XQuery processor, developed by Saxonica
Brought to you by:
mhkay
A NullPointerException may occur in the NamePool when
taking input from a DOM Source. I haven't been able to
determine the exact conditions, a necessary but not
sufficient condition is that the source document has a
default namespace declaration.
The fix is to change the code at line 302 of
net.sf.saxon.dom.DOMWrapper to:
if (node.getNamespaceURI() != null) { String prefix = node.getPrefix(); if (prefix == null) { prefix = ""; } namecode =
docWrapper.namePool.allocate(prefix,
node.getNamespaceURI(),
node.getLocalName());
return namecode;
}
Michael Kay
Logged In: YES
user_id=992516
I haven't analyzed this enough to be sure, but it seems to me
that the following is sufficient:
Like this:
<SomeElement xmlns="http://www.site.com">
</SomeElement>
The following doesn't cause the exception:
<abc:SomeElement xmlns="http://www.site.com" xmlns:abc="http://www.site.com">
</abc:SomeElement>
Milan