|
Java EE 5 SDK 深圳电信培训中心.徐海蛟老师. |
||||||||
上一个类 下一个类 | 框架 无框架 | ||||||||
摘要: 嵌套 | 字段 | 构造器 | 方法 | 详细信息: 字段 | 构造器 | 方法 |
javax.xml.stream Class XMLOutputFactory
java.lang.Object javax.xml.stream.XMLOutputFactory
public abstract class XMLOutputFactory
- extends Object
Defines an abstract implementation of a factory for getting XMLEventWriters and XMLStreamWriters. The following table defines the standard properties of this specification. Each property varies in the level of support required by each implementation. The level of support required is described in the 'Required' column.
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));
This property specifies that the writer default namespace prefix declarations. The default value is 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 defaultNamespace is bound and in scope and the default namespace matches the URI of the attribute or StartElement QName 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.
- 版本:
- 1.0
- 作者:
- Copyright (c) 2003 by BEA Systems. All Rights Reserved.
- 另请参见:
XMLInputFactory
,XMLEventWriter
,XMLStreamWriter
字段摘要 | |
---|---|
static String |
IS_REPAIRING_NAMESPACES
Property used to set prefix defaulting on the output side |
构造器摘要 | |
---|---|
protected |
XMLOutputFactory()
|
方法摘要 | |
---|---|
abstract XMLEventWriter |
createXMLEventWriter(OutputStream stream)
Create a new XMLEventWriter that writes to a stream |
abstract XMLEventWriter |
createXMLEventWriter(OutputStream stream,
String encoding)
Create a new XMLEventWriter that writes to a stream |
abstract XMLEventWriter |
createXMLEventWriter(Result result)
Create a new XMLEventWriter that writes to a JAXP result. |
abstract XMLEventWriter |
createXMLEventWriter(Writer stream)
Create a new XMLEventWriter that writes to a writer |
abstract XMLStreamWriter |
createXMLStreamWriter(OutputStream stream)
Create a new XMLStreamWriter that writes to a stream |
abstract XMLStreamWriter |
createXMLStreamWriter(OutputStream stream,
String encoding)
Create a new XMLStreamWriter that writes to a stream |
abstract XMLStreamWriter |
createXMLStreamWriter(Result result)
Create a new XMLStreamWriter that writes to a JAXP result. |
abstract XMLStreamWriter |
createXMLStreamWriter(Writer stream)
Create a new XMLStreamWriter that writes to a writer |
abstract Object |
getProperty(String name)
Get a feature/property on the underlying implementation |
abstract boolean |
isPropertySupported(String name)
Query the set of properties that this factory supports. |
static XMLOutputFactory |
newInstance()
Create a new instance of the factory. |
static XMLInputFactory |
newInstance(String factoryId,
ClassLoader classLoader)
Create a new instance of the factory |
abstract void |
setProperty(String name,
Object value)
Allows the user to set specific features/properties on the underlying implementation. |
类方法继承 java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
字段详细信息 |
---|
IS_REPAIRING_NAMESPACES
public static final String IS_REPAIRING_NAMESPACES
- Property used to set prefix defaulting on the output side
- 另请参见:
- 常量字段
构造器详细信息 |
---|
XMLOutputFactory
protected XMLOutputFactory()
方法详细信息 |
---|
newInstance
public static XMLOutputFactory newInstance() throws FactoryConfigurationError
- Create a new instance of the factory.
- 抛出异常:
FactoryConfigurationError
- if an instance of this factory cannot be loaded
newInstance
public static XMLInputFactory newInstance(String factoryId, ClassLoader classLoader) throws FactoryConfigurationError
- Create a new instance of the factory
- 参数:
factoryId
- Name of the factory to find, same as a property nameclassLoader
- classLoader to use- 返回:
- the factory implementation
- 抛出异常:
FactoryConfigurationError
- if an instance of this factory cannot be loaded
createXMLStreamWriter
public abstract XMLStreamWriter createXMLStreamWriter(Writer stream) throws XMLStreamException
- Create a new XMLStreamWriter that writes to a writer
- 参数:
stream
- the writer to write to- 抛出异常:
XMLStreamException
createXMLStreamWriter
public abstract XMLStreamWriter createXMLStreamWriter(OutputStream stream) throws XMLStreamException
- Create a new XMLStreamWriter that writes to a stream
- 参数:
stream
- the stream to write to- 抛出异常:
XMLStreamException
createXMLStreamWriter
public abstract XMLStreamWriter createXMLStreamWriter(OutputStream stream, String encoding) throws XMLStreamException
- Create a new XMLStreamWriter that writes to a stream
- 参数:
stream
- the stream to write toencoding
- the encoding to use- 抛出异常:
XMLStreamException
createXMLStreamWriter
public abstract XMLStreamWriter createXMLStreamWriter(Result result) throws XMLStreamException
- Create a new XMLStreamWriter that writes to a JAXP result. This method is optional.
- 参数:
result
- the result to write to- 抛出异常:
UnsupportedOperationException
- if this method is not supported by this XMLOutputFactoryXMLStreamException
createXMLEventWriter
public abstract XMLEventWriter createXMLEventWriter(Result result) throws XMLStreamException
- Create a new XMLEventWriter that writes to a JAXP result. This method is optional.
- 参数:
result
- the result to write to- 抛出异常:
UnsupportedOperationException
- if this method is not supported by this XMLOutputFactoryXMLStreamException
createXMLEventWriter
public abstract XMLEventWriter createXMLEventWriter(OutputStream stream) throws XMLStreamException
- Create a new XMLEventWriter that writes to a stream
- 参数:
stream
- the stream to write to- 抛出异常:
XMLStreamException
createXMLEventWriter
public abstract XMLEventWriter createXMLEventWriter(OutputStream stream, String encoding) throws XMLStreamException
- Create a new XMLEventWriter that writes to a stream
- 参数:
stream
- the stream to write toencoding
- the encoding to use- 抛出异常:
XMLStreamException
createXMLEventWriter
public abstract XMLEventWriter createXMLEventWriter(Writer stream) throws XMLStreamException
- Create a new XMLEventWriter that writes to a writer
- 参数:
stream
- the stream to write to- 抛出异常:
XMLStreamException
setProperty
public abstract void setProperty(String name, Object value) throws IllegalArgumentException
- Allows the user to set specific features/properties on the underlying implementation.
- 参数:
name
- The name of the propertyvalue
- The value of the property- 抛出异常:
IllegalArgumentException
- if the property is not supported
getProperty
public abstract Object getProperty(String name) throws IllegalArgumentException
- Get a feature/property on the underlying implementation
- 参数:
name
- The name of the property- 返回:
- The value of the property
- 抛出异常:
IllegalArgumentException
- if the property is not supported
isPropertySupported
public abstract boolean isPropertySupported(String name)
- Query the set of properties that this factory supports.
- 参数:
name
- The name of the property (may not be null)- 返回:
- true if the property is supported and false otherwise
|
Java EE 5 SDK 深圳电信培训中心.徐海蛟老师. |
||||||||
上一个类 下一个类 | 框架 无框架 | ||||||||
摘要: 嵌套 | 字段 | 构造器 | 方法 | 详细信息: 字段 | 构造器 | 方法 |
提交错误或意见
版权所有 2007 Sun Microsystems, Inc. 保留所有权利。 请遵守许可证条款。深圳电信培训中心.徐海蛟老师教学参考.