Description
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 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 when pretty-print is required.
For details, please refer to the bug report and the java.xml module-summary.
Usage:
```
// to set the property, get an instance of LSSerializer and set it along with pretty-print
LSSerializer ser = impl.createLSSerializer();
ser.getDomConfig().setParameter("format-pretty-print", true);
ser.getDomConfig().setParameter("http://www.oracle.com/xml/jaxp/properties/isStandalone", true);
// to use the System property, set it before initializing a LSSerializer
System.setProperty("jdk.xml.isStandalone", “true”);
// to clear the property, place the line anywhere after the LSSerializer is initialized
System.clearProperty("jdk.xml.isStandalone");
```
For details, please refer to the bug report and the java.xml module-summary.
Usage:
```
// to set the property, get an instance of LSSerializer and set it along with pretty-print
LSSerializer ser = impl.createLSSerializer();
ser.getDomConfig().setParameter("format-pretty-print", true);
ser.getDomConfig().setParameter("http://www.oracle.com/xml/jaxp/properties/isStandalone", true);
// to use the System property, set it before initializing a LSSerializer
System.setProperty("jdk.xml.isStandalone", “true”);
// to clear the property, place the line anywhere after the LSSerializer is initialized
System.clearProperty("jdk.xml.isStandalone");
```
Attachments
Issue Links
- duplicates
-
JDK-8261861 Release Note: XML Implementation Specific Features and Properties
- Resolved