RFR: JDK-8289510 : Improve test coverage for XPath Axes: namespace [v2]
Bill Huang
duke at openjdk.org
Wed Aug 31 21:41:13 UTC 2022
On Thu, 25 Aug 2022 16:58:29 GMT, Mahendra Chhipa <mchhipa at openjdk.org> wrote:
>> Added tests for namespace Axis. Tests incluse namspace expressions, namespace node counts and namespace node scope.
>
> Mahendra Chhipa has updated the pull request incrementally with one additional commit since the last revision:
>
> Implemented the review comments.
test/jaxp/javax/xml/jaxp/unittest/xpath/XPathExpNamespaceTest.java line 114:
> 112: {"//Customer/Name/namespace::dog", "dog", "xmlns", "xmlns:dog","www.pets.com"},
> 113: {"/Customers/Customer/Name/namespace::dog", "dog", "xmlns", "xmlns:dog","www.pets.com"}
> 114: };
It would good to test an element with a prefix. For example,
`{"//www.foo.com:Customer/namespace::foo", "foo", "xmlns", "xmlns:foo", "www.foo.com"}`
I am not sure if the above expression is a practical use case. We may want to use a more real-world expression.
`"/Customers/*[name()='foo:Customer']/namespace::foo"`
Some other expressions as follows,
`"/Customers/*[namespace-uri()='www.foo.com']/namespace::foo"`
`"/Customers/*[contains(name(.), 'foo:')]/namespace::foo"`
`"/Customers/*[starts-with(name(.), 'foo:')]/namespace::foo"`
`"//*[local-name()='Customer' and namespace-uri()='www.foo.com']/namespace::foo"`
test/jaxp/javax/xml/jaxp/unittest/xpath/XPathExpNamespaceTest.java line 131:
> 129: {"//VendCustomer/Address/namespace::street"},
> 130: {"/Customers/VendCustomer/Address/namespace::street"}
> 131: };
It would be good to test empty namespace nodes on attribute nodes. For example,
`"//@id/namespace::*"`
`"//@*[name()='foo:id']/namespace::*"`
`"//@*[local-name()='id' and namespace-uri()='www.foo.com']/namespace::*"`
test/jaxp/javax/xml/jaxp/unittest/xpath/XPathExpNamespaceTest.java line 164:
> 162: {"namespace-uri(/Customers/Customer/www.pets.com:Address)","www.pets.com" },
> 163: {"namespace-uri(/Customers/VendCustomer/Email)","" }
> 164: };
It would be good to test namespace-uri() on attributes. For example,
`{"namespace-uri(//@*[name()='id'])", ""}`
`{"namespace-uri(//@*[name()='foo:id'])", "www.foo.com"}`
-------------
PR: https://git.openjdk.org/jdk/pull/9906
More information about the core-libs-dev
mailing list