Module java.xml
Defines the Java API for XML Processing (JAXP), the Streaming API for XML (StAX), the Simple API for XML (SAX), and the W3C Document Object Model (DOM) API.
- Implementation Note:
-
Implementation Specific Features and Properties
In addition to the standard features and properties described within the public APIs of this module, the JDK implementation supports a further number of implementation specific features and properties. This section describes the naming convention, System Properties, jaxp.properties, scope and order, and processors to which a property applies. A table listing the implementation specific features and properties which the implementation currently supports can be found at the end of this note.Naming Convention
The names of the features and properties are fully qualified, composed of a prefix and name.Prefix
The prefix for JDK properties is defined as:http://www.oracle.com/xml/jaxp/properties/
The prefix for features:http://www.oracle.com/xml/jaxp/features/
The prefix for System Properties:jdk.xml.
Name
A name may consist of one or multiple words that are case-sensitive. All letters of the first word are in lowercase, while the first letter of each subsequent word is capitalized.An example of a property that indicates whether an XML document is standalone would thus have a format:
http://www.oracle.com/xml/jaxp/properties/isStandalone
and a corresponding System Property:System Properties
A property may have a corresponding System Property that has the same name except for the prefix as shown above. A System Property should be set prior to the creation of a processor and may be cleared afterwards.jaxp.properties
A system property can be specified in thejaxp.properties
file to set the behavior for all invocations of the JDK. The format issystem-property-name=value
. For example:jdk.xml.isStandalone=true
For details about the JAXP configuration file
jaxp.properties
, refer toSAXParserFactory#newInstance
.Scope and Order
TheXMLConstants.FEATURE_SECURE_PROCESSING
feature (hereafter referred to as secure processing) is required for XML processors including DOM, SAX, Schema Validation, XSLT, and XPath. Any properties flagged as"security: yes"
(hereafter referred to as security properties) in table Features And Properties are enforced when secure processing is set to true. Such enforcement includes setting security features to true and limits to the defined values shown in the table. The property values will not be affected, however, when setting secure processing to false.When the Java Security Manager is present, secure processing is set to true and can not be turned off. The security properties are therefore enforced.
Properties specified in the jaxp.properties file affect all invocations of the JDK, and will override their default values, or those that may have been set by secure processing.
System properties, when set, affect the invocation of the JDK and override the default settings or those that may have been set in jaxp.properties or by secure processing.
JAXP properties specified through JAXP factories or processors (e.g. SAXParser) take preference over system properties, the jaxp.properties file, as well as secure processing.
Processor Support
Features and properties may be supported by one or more processors. The following table lists the processors by IDs that can be used for reference.ID Name How to set the property DOM DOM Parser DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
dbf.setAttribute(name, value);
SAX SAX Parser SAXParserFactory spf = SAXParserFactory.newInstance();
SAXParser parser = spf.newSAXParser();
parser.setProperty(name, value);
StAX StAX Parser XMLInputFactory xif = XMLInputFactory.newInstance();
xif.setProperty(name, value);
Validation XML Validation API SchemaFactory schemaFactory = SchemaFactory.newInstance(schemaLanguage);
schemaFactory.setProperty(name, value);
Transform XML Transform API TransformerFactory factory = TransformerFactory.newInstance();
factory.setAttribute(name, value);
DOMLS DOM Load and Save LSSerializer serializer = domImplementation.createLSSerializer();
serializer.getDomConfig().setParameter(name, value);
Implementation Specific Features and Properties
This section lists features and properties supported by the JDK implementation.Name [1] Description System Property [2] jaxp.properties [2] Value [3] Security [4] Supported Processor [5] Since [6] Type Value Default isStandalone indicates that the serializer should treat the output as a standalone document. The property can be used to ensure a newline is written after the XML declaration. Unlike the property xml-declaration
, this property does not have an effect on whether an XML declaration should be written out.yes yes boolean true/false false No DOMLS 17 [1] The name of a property. The fully-qualified name, prefix + name, should be used when setting the property.
[2] A value "yes" indicates there is a corresponding System Property for the property, "no" otherwise.
[3] The value must be exactly as listed in this table, case-sensitive. The value type for the corresponding System Property is String. For boolean type, the system property is true only if it is "true" and false otherwise.
[4] A value "yes" indicates the property is a Security Property. Refer to the Scope and Order on how secure processing may affect the value of a Security Property.
[5] One or more processors that support the property. The values of the field are IDs described in table Processors.
[6] Indicates the initial release the property is introduced.
- Module Graph:
- Since:
- 9
Packages
Package | Description |
---|---|
javax.xml | Defines constants for XML processing. |
javax.xml.catalog | Provides the classes for implementing XML Catalogs OASIS Standard V1.1, 7 October 2005. |
javax.xml.datatype | Defines XML/Java Type Mappings. |
javax.xml.namespace | Defines XML Namespace processing. |
javax.xml.parsers | Provides the classes for processing XML documents with a SAX (Simple API for XML) parser or a DOM (Document Object Model) Document builder. |
javax.xml.stream | Defines interfaces and classes for the Streaming API for XML (StAX). |
javax.xml.stream.events | Defines event interfaces for the Streaming API for XML (StAX). |
javax.xml.stream.util | Provides utility classes for the Streaming API for XML (StAX). |
javax.xml.transform | Defines the generic APIs for processing transformation instructions, and performing a transformation from source to result. |
javax.xml.transform.dom | Provides DOM specific transformation classes. |
javax.xml.transform.sax | Provides SAX specific transformation classes. |
javax.xml.transform.stax | Provides StAX specific transformation classes. |
javax.xml.transform.stream | Provides stream and URI specific transformation classes. |
javax.xml.validation | Provides an API for validation of XML documents. |
javax.xml.xpath | Provides an object-model neutral API for the evaluation of XPath expressions and access to the evaluation environment. |
org.w3c.dom | Provides the interfaces for the Document Object Model (DOM). |
org.w3c.dom.bootstrap | Provides a factory for obtaining instances of |
org.w3c.dom.events | Provides interfaces for DOM Level 2 Events. |
org.w3c.dom.ls | Provides interfaces for DOM Level 3 Load and Save. |
org.w3c.dom.ranges | Provides interfaces for DOM Level 2 Range. |
org.w3c.dom.traversal | Provides interfaces for DOM Level 2 Traversal. |
org.w3c.dom.views | Provides interfaces for DOM Level 2 Views. |
org.xml.sax | Provides the core SAX APIs. |
org.xml.sax.ext | Provides interfaces to SAX2 facilities that conformant SAX drivers won't necessarily support. |
org.xml.sax.helpers | Provides helper classes, including support for bootstrapping SAX-based applications. |
Services
Type | Description |
---|---|
DatatypeFactory | Factory that creates new |
DocumentBuilderFactory | Defines a factory API that enables applications to obtain a parser that produces DOM object trees from XML documents. |
SAXParserFactory | Defines a factory API that enables applications to configure and obtain a SAX based parser to parse XML documents. |
SchemaFactory | Factory that creates |
TransformerFactory | A TransformerFactory instance can be used to create |
XMLEventFactory | This interface defines a utility class for creating instances of XMLEvents |
XMLInputFactory | Defines an abstract implementation of a factory for getting streams. |
XMLOutputFactory | Defines an abstract implementation of a factory for getting XMLEventWriters and XMLStreamWriters. |
XMLReader | Interface for reading an XML document using callbacks. |
XPathFactory | An |
© 1993, 2020, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from Debian's OpenJDK Development Kit package.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses (see Debian package).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
https://docs.oracle.com/en/java/javase/11/docs/api/java.xml/module-summary.html