public abstract class XMLOutputFactory
extends java.lang.Object
Configuration parameters | ||||
---|---|---|---|---|
Property Name | Behavior | Return type | Default Value | Required |
javax.xml.stream.isRepairingNamespaces | defaults prefixes on the output side | Boolean | False | Yes |
The following paragraphs describe the namespace and prefix repair algorithm:
The property can be set with the following code line:
setProperty("javax.xml.stream.isRepairingNamespaces",new Boolean(true|false));
If a writer isRepairingNamespaces it will create a namespace declaration on the current StartElement for any attribute that does not currently have a namespace declaration in scope. If the StartElement has a uri but no prefix specified a prefix will be assigned: if the prefix has not been declared in a parent of the current StartElement it will be declared on the current StartElement. If the default namespace is bound and in scope and the default namespace value matches the URI of the attribute or of the StartElement's qualified name, then no prefix will be assigned.
If an element or attribute name has a prefix, but is not bound to any namespace URI, then the prefix will be removed during serialization.
If element and/or attribute names in the same start or empty-element tag are bound to different namespace URIs and are using the same prefix then the element or the first occurring attribute retains the original prefix and the following attributes have their prefixes replaced with a new prefix that is bound to the namespace URIs of those attributes.
If an element or attribute name uses a prefix that is bound to a different URI than that inherited from the namespace context of the parent of that element and there is no namespace declaration in the context of the current element then such a namespace declaration is added.
If an element or attribute name is bound to a prefix and there is a namespace declaration that binds that prefix to a different URI then that namespace declaration is either removed if the correct mapping is inherited from the parent context of that element, or changed to the namespace URI of the element or attribute using that prefix.
XMLInputFactory
,
XMLStreamWriter
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
IS_REPAIRING_NAMESPACES
Property used to set prefix defaulting on the output side
|
Modifier | Constructor and Description |
---|---|
protected |
XMLOutputFactory() |
Modifier and Type | Method and Description |
---|---|
abstract XMLStreamWriter |
createXMLStreamWriter(java.io.OutputStream stream)
Create a new XMLStreamWriter that writes to a stream
|
abstract XMLStreamWriter |
createXMLStreamWriter(java.io.OutputStream stream,
java.lang.String encoding)
Create a new XMLStreamWriter that writes to a stream
|
abstract XMLStreamWriter |
createXMLStreamWriter(java.io.Writer stream)
Create a new XMLStreamWriter that writes to a writer
|
abstract java.lang.Object |
getProperty(java.lang.String name)
Get a feature/property on the underlying implementation
|
abstract boolean |
isPropertySupported(java.lang.String name)
Query the set of properties that this factory supports.
|
static XMLOutputFactory |
newInstance()
Create a new instance of the factory.
|
abstract void |
setProperty(java.lang.String name,
java.lang.Object value)
Allows the user to set specific features/properties on the underlying
implementation.
|
public static final java.lang.String IS_REPAIRING_NAMESPACES
public static XMLOutputFactory newInstance() throws FactoryConfigurationError
FactoryConfigurationError
- if an instance of this factory cannot be
loadedpublic abstract XMLStreamWriter createXMLStreamWriter(java.io.Writer stream) throws XMLStreamException
stream
- the writer to write toXMLStreamException
public abstract XMLStreamWriter createXMLStreamWriter(java.io.OutputStream stream) throws XMLStreamException
stream
- the stream to write toXMLStreamException
public abstract XMLStreamWriter createXMLStreamWriter(java.io.OutputStream stream, java.lang.String encoding) throws XMLStreamException
stream
- the stream to write toencoding
- the encoding to useXMLStreamException
public abstract void setProperty(java.lang.String name, java.lang.Object value) throws java.lang.IllegalArgumentException
name
- The name of the propertyvalue
- The value of the propertyjava.lang.IllegalArgumentException
- if the property is not
supportedpublic abstract java.lang.Object getProperty(java.lang.String name) throws java.lang.IllegalArgumentException
name
- The name of the propertyjava.lang.IllegalArgumentException
- if the property is not supportedpublic abstract boolean isPropertySupported(java.lang.String name)
name
- The name of the property (may not be null)true
if the property is supported and
false
otherwiseCopyright © 2013, Oracle and/or its affiliates. All rights reserved.
Use is subject to License Terms. Your use of this web site or any of its contents or software indicates your agreement to be bound by these License Terms.