Actions
Bug #5831
closedSaxon.Ejava.lang.IllegalArgumentException : Unsupported node type in DOM! XmlDeclaration instance System.Xml.XmlDeclaration
Start date:
2023-01-18
Due date:
% Done:
0%
Estimated time:
Legacy ID:
Applies to branch:
Fix Committed on Branch:
Fixed in Maintenance Release:
Platforms:
.NET
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.
Please register to edit this issue
Actions