Bug #5831
closedSaxon.Ejava.lang.IllegalArgumentException : Unsupported node type in DOM! XmlDeclaration instance System.Xml.XmlDeclaration
0%
Description
For some XPath expression evaluation (like //root | //item
), when using a wrapped DOM document that was parsed from lexical XML with an XML declaration, SaxonCS runs into an error "Saxon.Ejava.lang.IllegalArgumentException : Unsupported node type in DOM! XmlDeclaration instance System.Xml.XmlDeclaration":
Sample test case:
[Test]
public void WrapDOMDocumentWithXmlDeclaration()
{
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.LoadXml(@"<?xml version='1.0'?><root>
<item>a</item>
<item>b</item>
</root>");
XdmNode xdmDoc = docBuilder.Wrap(xmlDoc);
var xdmValue = xpathCompiler.Evaluate("//root | //item", xdmDoc);
Assert.That(xdmValue.Count, Is.EqualTo(3));
}
Stack trace:
DomNodeWrapper.makeWrapper(XmlNode node, DomDocumentTree docTree, DomNodeWrapper parent, Int32 index)
DomNodeWrapper.makeWrapper(XmlNode node, DomDocumentTree docTree)
DomNodeWrapper.getFirstChild()
SteppingNavigator.getFollowingNode(SteppingNode start, SteppingNode anchor)
FollowingFilteredNodeStepper.step(SteppingNode node)
DescendantAxisIterator.next()
SequenceExtent.from(SequenceIterator iter)
SequenceTool.toGroundedValue(SequenceIterator iterator)
XPathSelector.evaluate()
XPathCompiler.evaluate(String expression, XdmItem contextItem)
XPathCompiler.Evaluate(String expression, XdmItem contextItem)
Tests.WrapDOMDocumentWithXmlDeclaration() Zeile 26
I found it with SaxonCS 12.0, haven't checked so far whether that is a regression in 12 or also occurred in 11.
Updated by Martin Honnen almost 2 years ago
I get the same error with SaxonCS-b6 11.4.1:
Saxon.Ejava.lang.IllegalArgumentException : Unsupported node type in DOM! XmlDeclaration instance System.Xml.XmlDeclaration
DomNodeWrapper.makeWrapper(XmlNode node, DomDocumentTree docTree, DomNodeWrapper parent, Int32 index)
DomNodeWrapper.makeWrapper(XmlNode node, DomDocumentTree docTree)
DomNodeWrapper.getFirstChild()
SteppingNavigator.getFollowingNode(SteppingNode start, SteppingNode anchor)
FollowingFilteredNodeStepper.step(SteppingNode node)
DescendantAxisIterator.next()
SequenceExtent.from(SequenceIterator iter)
SequenceTool.toGroundedValue(SequenceIterator iterator)
XPathSelector.evaluate()
XPathCompiler.evaluate(String expression, XdmItem contextItem)
XPathCompiler.Evaluate(String expression, XdmItem contextItem)
Tests.WrapDOMDocumentWithXmlDeclaration() Zeile 28
Updated by Michael Kay almost 2 years ago
As reported in bug #5820 I've now added the ability to run the whole QT3 test suite on a wrapped DOM input; this found quite a few such problems and hopefully this one has been picked up.
Updated by Michael Kay almost 2 years ago
- Status changed from New to Duplicate
I can confirm this test case is now working on both 11.x and 12.x following the changes for bug #5820
Please register to edit this issue