0

We are adding code to convert a DOM to Domino before invoking saxon library to process xquery expression, which involves constructing a xml document as output. Following exception is seen, for DOM created using certain DOM builders:

java.lang.NullPointerException
    at net.sf.saxon.om.NameOfNode.equals(NameOfNode.java:177)
    at net.sf.saxon.om.SingletonAttributeMap.put(SingletonAttributeMap.java:69)
    at net.sf.saxon.om.NodeInfo.attributes(NodeInfo.java:528)
    at net.sf.saxon.tree.util.Navigator.copy(Navigator.java:673)
    at net.sf.saxon.om.NodeInfo.copy(NodeInfo.java:568)
    at net.sf.saxon.tree.util.Navigator.copy(Navigator.java:679)
    at net.sf.saxon.om.NodeInfo.copy(NodeInfo.java:568)
    at net.sf.saxon.event.ComplexContentOutputter.decompose(ComplexContentOutputter.java:860)
    at net.sf.saxon.event.ComplexContentOutputter.append(ComplexContentOutputter.java:656)

The cause seems to be that node.getLocalName() for attribute type of nodes, returns null for Domino. Same setup works if DOM is converted to Tiny Tree or passed using a DOMWrapper to Saxon.

Xquery using domino, expected to work, threw Exception.

jmashalk
  • 21
  • 2

1 Answers1

0

You've raised this on the Saxonica support forum at https://saxonica.plan.io/issues/5727

To summarise:

(a) Whether using the DOM wrapper in Saxon, or the Domino structure (which adds extra indexing), the DOM should be namespace-aware and should be constructed using namespace-aware (i.e. level-2) interfaces.

(b) If you don't follow that rule, we shouldn't crash (so we'll fix the crash that you've observed), but we can't guarantee delivering XPath-conformant results. The mapping from a non-namespace-aware DOM to a valid XDM instance is undefined and unpredictable, so the results of XPath processing are undefined. This might mean, for example, that when the result is serialized, it's not well-formed XML (for example, it might contain undeclared prefixes in element or attribute names.

Michael Kay
  • 156,231
  • 11
  • 92
  • 164