Project

Profile

Help

Bug #5831

closed

Saxon.Ejava.lang.IllegalArgumentException : Unsupported node type in DOM! XmlDeclaration instance System.Xml.XmlDeclaration

Added by Martin Honnen almost 2 years ago. Updated almost 2 years ago.

Status:
Duplicate
Priority:
Normal
Assignee:
-
Category:
DOM Interface
Sprint/Milestone:
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.

Actions #1

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
Actions #2

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.

Actions #3

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

Also available in: Atom PDF