Skip to content

Conversation

@macbarSB
Copy link

Hello

Current version has an issue, when xml contains comment followed by a whitespace character. This leads to situation, when after first iteration of xpath selection the hasChildNodes() method returns true for CommentXobj instance. With that next usages of selectPath(...) return incorrect result.

Please see code below for reproduction:

        XmlObject xmlObject = XmlObject.Factory.parse("<outerTag><!-- comment with whitespace after it --> <innerTag>textToFind1</innerTag><innerTag>textToFind2</innerTag></outerTag>");
        String xpath = "//innerTag";

        System.out.println(Arrays.stream(xmlObject.selectPath(xpath)).toList().size()); // prints 2
        System.out.println(Arrays.stream(xmlObject.selectPath(xpath)).toList().size()); // prints 0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant