JDK-8267809 : XPathEvaluationResult.XPathResultType.NODESET maps to incorrect type
  • Type: CSR
  • Component: xml
  • Sub-Component: javax.xml.xpath
  • Priority: P2
  • Status: Closed
  • Resolution: Approved
  • Fix Versions: 17
  • Submitted: 2021-05-26
  • Updated: 2021-06-30
  • Resolved: 2021-05-28
Related Reports
CSR :  
Description
Summary
-------

Makes a correction to XPathEvaluationResult.XPathResultType.NODESET mapping. Clarifies the supported types for the evaluateExpression methods.

Problem
-------

During the development of the XPath enhancement (JDK-8054196), the representation of NODESET had evolved into a new class `XPathNodes` because of the lack of `Iterable` in the `NodeList` it originally mapped to. The specification of the Enum mapping in `XPathEvaluationResult.XPathResultType` however, was mistakenly left unchanged.

Furthermore, in parts of the specification, that is, the `evaluateExpression` methods in `XPath` and `XPathExpression`, it was not clearly indicated what are valid class types for the `type` parameter.

Solution
--------

Fix the javadoc for `XPathEvaluationResult.XPathResultType.NODESET` to state that it maps to `XPathNodes`.

Add documentation in the class type definitions and `evaluateExpression` methods to explain the differences between the old QName and new Class type mappings. Add links from the type parameter for the `evaluateExpression` method to the class type definitions.

Specification
-------------

1. `XPathEvaluationResult.XPathResultType.NODESET`

    Corrected the mapping class as being `XPathNodes`.
    Fixed a typo to the javadoc for `NODE` to `NODE` instead of `NODESET`.
    <br><br>
2. Package summary

    Add the following to section `3.3 Enum types`:

    There are two differences in between the Enum and QName mappings:
  - NUMBER<br>
    In the QName mapping, NUMBER was mapped to a double data type, while in the Enum mapping, it is expanded to support Double, Integer and Long.<br><br>
  - NODESET<br>
    In the QName mapping, NODESET was mapped to a NodeList, while in the Enum mapping, it is XPathNodes.

3. `evaluateExpression` methods in XPath and XPathExpression

    Add a statement to indicate the valid types as those listed in section `3.2 Class types` in the package summary.

----
specdiff 01: http://cr.openjdk.java.net/~joehw/jdk17/8266559/specdiff_01/overview-summary.html

spec 01 (useful for verifying the links): http://cr.openjdk.java.net/~joehw/jdk17/8266559/spec_01/

Attached: 8266559_spec_01.zip, 8266559_specdiff_01.zip

----
Update 02: updated item 2. Package summary.

2. Package summary

    Add the following to section `3.3 Enum types`:

    Note the differences between the Enum and QName mappings:

    - NUMBER<br>
    The Enum mapping for NUMBER supports Double, Integer and Long.<br><br>

    - NODESET<br>
    The Enum mapping for NODESET is XPathNodes instead of NodeList in the QName mapping.


specdiff 02: http://cr.openjdk.java.net/~joehw/jdk17/8266559/specdiff_02/overview-summary.html

spec 02: http://cr.openjdk.java.net/~joehw/jdk17/8266559/spec_02/

Attached: 8266559_spec_02.zip, 8266559_specdiff_02.zip

Comments
Moving to Approved.
28-05-2021