Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8261856 Documenting the implementation specific features and properties
  3. JDK-8261861

Release Note: XML implementation specific features and properties

    XMLWordPrintable

    Details

    • Type: Sub-task
    • Status: In Progress
    • Priority: P4
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: 17
    • Component/s: docs

      Description

      Documentation for Implementation Specific Features and Properties has been added to the java.xml module summary. Along with the existing properties, two new properties are introduced in JDK 17. The following section describes the changes in more detail.

      1) Add javadoc for the XML processing limits
          XML processing limits were introduced in JDK 7u45 and 8. They were previously documented in the Java Tutorial <a href="https://docs.oracle.com/javase/tutorial/jaxp/limits/index.html">Processing Limits</a> section.

          The definitions for these limits are now added to the module summary. See JDK-8261670.

      2) Move the description for jaxp.properties to module summary

      3) Add a property to control newline after XML header for DOM LSSerializer

          The DOM Load and Save `LSSerializer` does not have an explicit control for whether or not the XML Declaration ends with a newline. In this release, a JDK implementation specific property `http://www.oracle.com/xml/jaxp/properties/isStandalone` and a corresponding System property `jdk.xml.isStandalone` are added to control the addition of a newline and acts independently without having to set the pretty-print property. This property can be used to reverse the incompatible change introduced in Java SE 7 Update 4 with an update of Xalan 2.7.1 where a newline is omitted after the XML header.

          Usage:
      ```
          // to set the property, get an instance of LSSerializer
          LSSerializer ser = impl.createLSSerializer();
          // the isStandalone property is effective whether or not pretty-print is set
          ser.getDomConfig().setParameter("format-pretty-print", pretty ? true : false);
          ser.getDomConfig().setParameter("http://www.oracle.com/xml/jaxp/properties/isStandalone", standalone ? true : false);

          // to use the System property, set it before initializing a LSSerializer
          System.setProperty("jdk.xml.isStandalone", standalone ? “true” : "false");

          // to clear the property, place the line anywhere after the LSSerializer is initialized
          System.clearProperty("jdk.xml.isStandalone");

      ```
          See JDK-8249867.

      4) Add a property to control newline after XML header for XSLTC Serializer

          The XSLTC Serializer supported a property `http://www.oracle.com/xml/is-standalone`, introduced through JDK-7150637, to control whether or not the XML Declaration ends with a newline. It is however, not in compliant with the new specification for Implementation Specific Features and Properties. In order to maintain compatibility, the legacy property is preserved, and a new property `http://www.oracle.com/xml/properties/xsltcIsStandalone` along with a corresponding System property `jdk.xml.xsltcIsStandalone` are created to perform the same function for the XSLTC Serializer as the `isStandalone` property for DOMLS LSSerializer. Note that the former has an extra prefix `xsltc` to avoid conflict with the later in case it is set through the System property.

          Usage:
      ```
          // to set the property, get an instance of the Transformer
          Transformer transformer = getTransformer(…);
          // the isStandalone property is effective whether or not pretty-print is set
          transformer.setOutputProperty(OutputKeys.INDENT, pretty ? "yes" : "no");
          transformer.setOutputProperty("http://www.oracle.com/xml/jaxp/properties/xsltcIsStandalone", standalone ? "yes" : "no");

          // to use the System property, set it before initializing a Transformer
          System.setProperty("jdk.xml.xsltcIsStandalone", standalone ? "yes" : "no");

          // to clear the property, place the line anywhere after the Transformer is initialized
          System.clearProperty("jdk.xml.xsltcIsStandalone");

      ```
          See JDK-8260858.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              joehw Joe Wang
              Reporter:
              joehw Joe Wang
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated: