JDK-8259352 : Documenting the implementation specific features and properties
  • Type: CSR
  • Component: xml
  • Sub-Component: jaxp
  • Priority: P3
  • Status: Closed
  • Resolution: Approved
  • Fix Versions: 17
  • Submitted: 2021-01-07
  • Updated: 2021-01-27
  • Resolved: 2021-01-27
Related Reports
CSR :  
Description
Summary
-------

The DOM Load and Save LSSerializer does not have an explicit control for whether or not the XML Declaration ends with a newline. A JDK implementation specific property and corresponding System property are added to control the addition of a newline.

Add an implementation note in the java.xml module summary to document implementation specific features and properties.

Problem
-------

The DOM Load and Save LSSerializer writes out an XML document without a newline after the XML declaration even when pretty-print is required. This issue is a regression introduced after the update of Xalan 2.7.1. In Xalan 2.7.1, two conditions were added to determine whether a newline should be added after the declaration: standalone is specified; A DOCTYPE exists. Without meeting either or one of these conditions, the serializer would produce no newline after the declaration even though pretty-print is requested through the property ���format-pretty-print���. The behavior change may cause failure in applications that depend on the format of the resulting document.

A bug report was first filed in 7u4 (JDK-7150637) when the change in the serializer was manifested through the Transform API. The current report (https://bugs.openjdk.java.net/browse/JDK-8249867) showed similar issue when the DOM Load and Save API are used.

In addition to the current issue, it is noted that there is a lack of documentation for the implementation specific features and properties in the javadoc.

Solution
--------

To address the current issue, add a JDK implementation specific property `isStandalone` that can be set on a LSSerializer through the DOMConfiguration in the org.w3c.dom.ls package. The new property can be used in new code to reverse the behavior change. Add a corresponding System property as a means for existing code to do the same.

To address the generally inadequacy on documentation, add an implementation note to java.xml module summary to cover the property above and also establish a framework for documenting other new or existing properties.

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

Add an implementation note for the `isStandalone` property to java.xml module-summary (java.xml/module-info.java). Since this is the first property to be added to the module-info, a full description about Implementation specific features and properties is added prior to the introduction of the property. Further property additions will simply be appended to the Properties table.

Specification attached. Please see the **Implementation Note** section in page java.xml/module-summary.html. 

Below is a link to the page for convenience:
http://cr.openjdk.java.net/~joehw/jdk17/8249867/spec_04/java.xml/module-summary.html
Comments
Thanks for the updates [~joehw]; moving to Approved.
27-01-2021

Added "Default" to the "Value" column, refer to the table "Features and Properties". The example system property "jdk.xml.isStandalone" and prefix "jdk.xml." now use @systemProperty instead of @code. Additionally, added a link for the supported processors to the processor ID. Updated spec: attachment spec_04_8249867.zip and convenient link to spec_04.
26-01-2021

Moving back to Provisional, not Approved. Please state in the javadoc specification what the default value for the new property is. Is the @systemProperty (JDK-8211132) javadoc tag being used?
26-01-2021

The existing property: does not conform to the naming convention; did not have a corresponding System property; was not documented. We plan to apply the newly-defined property to the Transform API while continue honoring the existing one. Updated specification: document the new property as an ImplNote in java.xml module-info. Will collect and add other existing properties to the ImplNote.
22-01-2021

Moving to Provisional, not Approved. Can the existing system property be reused to cover the new use cases? Where would these new properties be documented? At least for JDK 17, a location could be found in the javadcoc to describe the system property.
14-01-2021

For reference, there are two open bugs at Xalan for this issue: https://issues.apache.org/jira/browse/XALANJ-2388, and 2387.
07-01-2021