On Tue, 4 Oct 2022 13:01:40 GMT, Mahendra Chhipa <mchh...@openjdk.org> wrote:
> Added test cases for xpath Axis: > 1. descendant > 2. descendant-or-self > 3. following > 4. following-sibling test/jaxp/javax/xml/jaxp/unittest/xpath/XPathExpDescendantTest.java line 59: > 57: {"/Customers/Customer[@id='x1']/descendant::Address", > "/Customers/Customer[@id='x1']/Address"}, > 58: {"/Customers/Customer[@id='x1']/descendant::*", > "/Customers/Customer[@id='x1']//*"}, > 59: {"/Customers/foo:Customer/foo:Address/descendant::*", > "/Customers/foo:Customer/foo:Address//*"}, It would be good to add a test case to address the grandchildren or grand-grandchildren nodes from the context node. e.g. `/Customers/descendant::Street` `/Customers//Street` test/jaxp/javax/xml/jaxp/unittest/xpath/XPathExpDescendantTest.java line 65: > 63: > {"/Customers/Customer[@id='x1']/descendant-or-self::Address", > "/Customers/Customer[@id = 'x1']/Address"}, > 64: {"/Customers/Customer[@id='x1']/descendant-or-self::*", > "/Customers/Customer[@id='x1'] | /Customers/Customer[@id = 'x1']//*"}, > 65: > {"/Customers/foo:Customer/foo:Address/descendant-or-self::*", > "/Customers/foo:Customer/foo:Address | > /Customers/foo:Customer/foo:Address//*"} In the spec, there is a special note saying, "the location path //para[1] does not mean the same as the location path /descendant::para[1]". Based on this, it would be good to add a position test case for descendant. e.g. `/Customers/descendant::Street[2]` `/Customers/descendant::Street[position()=2]` `//Street[2]` `(//Street)[2]` test/jaxp/javax/xml/jaxp/unittest/xpath/XPathExpDescendantTest.java line 108: > 106: }; > 107: } > 108: It would be good to have a predicate test with descendant. e.g. `//*[not(descendant::*)]` `//*[descendant::Street and ancestor::Customer]` test/jaxp/javax/xml/jaxp/unittest/xpath/XPathExpFollowingTest.java line 56: > 54: {"/Customers/Customer[@id='x1']/following::Address", > "/Customers/Customer[@id != 'x1']/Address"}, > 55: {"/Customers/Customer[@id='x1']/following::*", > "/Customers/Customer[@id != 'x1']/descendant-or-self::* | > /Customers/foo:Customer/descendant-or-self::*"}, > 56: {"/Customers/foo:Customer/foo:Address/following::*", > "/Customers/foo:Customer/foo:Age | /Customers/foo:Customer/foo:ClubMember"}, It would be good to access the grandchildren or grand-grandchildren following nodes. e.g. `//Customer/following::Street` `//following::Street` test/jaxp/javax/xml/jaxp/unittest/xpath/XPathExpFollowingTest.java line 64: > 62: {"/Customers/Customer[@id='x1']/following-sibling::*", > "/Customers/Customer[@id != 'x1'] | /Customers/foo:Customer"}, > 63: > {"/Customers/foo:Customer/foo:Address/following-sibling::*", > "/Customers/foo:Customer/foo:Age | /Customers/foo:Customer/foo:ClubMember"} > 64: }; It would be good to add a position test. e.g. `//Customer/following::Street[2]` `//following::Street[2]` `//Customer/following-sibling::Customer[2]` `//following-sibling::Customer[2]` test/jaxp/javax/xml/jaxp/unittest/xpath/XPathExpFollowingTest.java line 108: > 106: }; > 107: } > 108: It would be good to add a predicate test for following. e.g. `//foo:Customer/*[not(following::*)]` `//*[not(following::*) and not(preceding::*)]` `//Street[following::Street and preceding::Street]` ------------- PR: https://git.openjdk.org/jdk/pull/10557