- java.lang.Object
-
- com.sun.xml.fastinfoset.stax.events.StAXEventWriter
-
- All Implemented Interfaces:
javax.xml.stream.util.XMLEventConsumer,javax.xml.stream.XMLEventWriter
public class StAXEventWriter extends java.lang.Object implements javax.xml.stream.XMLEventWriter
-
-
Field Summary
Fields Modifier and Type Field Description private javax.xml.stream.XMLStreamWriter_streamWriter
-
Constructor Summary
Constructors Constructor Description StAXEventWriter(javax.xml.stream.XMLStreamWriter streamWriter)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(javax.xml.stream.events.XMLEvent event)Add an event to the output stream Adding a START_ELEMENT will open a new namespace scope that will be closed when the corresponding END_ELEMENT is written.voidadd(javax.xml.stream.XMLEventReader eventReader)voidclose()Frees any resources associated with this streamvoidflush()Writes any cached events to the underlying output mechanismjavax.xml.namespace.NamespaceContextgetNamespaceContext()Returns the current namespace context.java.lang.StringgetPrefix(java.lang.String uri)Gets the prefix the uri is bound tovoidsetDefaultNamespace(java.lang.String uri)Binds a URI to the default namespace This URI is bound in the scope of the current START_ELEMENT / END_ELEMENT pair.voidsetNamespaceContext(javax.xml.namespace.NamespaceContext namespaceContext)Sets the current namespace context for prefix and uri bindings.voidsetPrefix(java.lang.String prefix, java.lang.String uri)Sets the prefix the uri is bound to.
-
-
-
Method Detail
-
flush
public void flush() throws javax.xml.stream.XMLStreamExceptionWrites any cached events to the underlying output mechanism- Specified by:
flushin interfacejavax.xml.stream.XMLEventWriter- Throws:
javax.xml.stream.XMLStreamException
-
close
public void close() throws javax.xml.stream.XMLStreamExceptionFrees any resources associated with this stream- Specified by:
closein interfacejavax.xml.stream.XMLEventWriter- Throws:
javax.xml.stream.XMLStreamException
-
add
public void add(javax.xml.stream.XMLEventReader eventReader) throws javax.xml.stream.XMLStreamException- Specified by:
addin interfacejavax.xml.stream.XMLEventWriter- Throws:
javax.xml.stream.XMLStreamException
-
add
public void add(javax.xml.stream.events.XMLEvent event) throws javax.xml.stream.XMLStreamExceptionAdd an event to the output stream Adding a START_ELEMENT will open a new namespace scope that will be closed when the corresponding END_ELEMENT is written.- Specified by:
addin interfacejavax.xml.stream.util.XMLEventConsumer- Specified by:
addin interfacejavax.xml.stream.XMLEventWriter- Throws:
javax.xml.stream.XMLStreamException
-
getPrefix
public java.lang.String getPrefix(java.lang.String uri) throws javax.xml.stream.XMLStreamExceptionGets the prefix the uri is bound to- Specified by:
getPrefixin interfacejavax.xml.stream.XMLEventWriter- Parameters:
uri- the uri to look up- Throws:
javax.xml.stream.XMLStreamException
-
getNamespaceContext
public javax.xml.namespace.NamespaceContext getNamespaceContext()
Returns the current namespace context.- Specified by:
getNamespaceContextin interfacejavax.xml.stream.XMLEventWriter- Returns:
- the current namespace context
-
setDefaultNamespace
public void setDefaultNamespace(java.lang.String uri) throws javax.xml.stream.XMLStreamExceptionBinds a URI to the default namespace This URI is bound in the scope of the current START_ELEMENT / END_ELEMENT pair. If this method is called before a START_ELEMENT has been written the uri is bound in the root scope.- Specified by:
setDefaultNamespacein interfacejavax.xml.stream.XMLEventWriter- Parameters:
uri- the uri to bind to the default namespace- Throws:
javax.xml.stream.XMLStreamException
-
setNamespaceContext
public void setNamespaceContext(javax.xml.namespace.NamespaceContext namespaceContext) throws javax.xml.stream.XMLStreamExceptionSets the current namespace context for prefix and uri bindings. This context becomes the root namespace context for writing and will replace the current root namespace context. Subsequent calls to setPrefix and setDefaultNamespace will bind namespaces using the context passed to the method as the root context for resolving namespaces.- Specified by:
setNamespaceContextin interfacejavax.xml.stream.XMLEventWriter- Parameters:
namespaceContext- the namespace context to use for this writer- Throws:
javax.xml.stream.XMLStreamException
-
setPrefix
public void setPrefix(java.lang.String prefix, java.lang.String uri) throws javax.xml.stream.XMLStreamExceptionSets the prefix the uri is bound to. This prefix is bound in the scope of the current START_ELEMENT / END_ELEMENT pair. If this method is called before a START_ELEMENT has been written the prefix is bound in the root scope.- Specified by:
setPrefixin interfacejavax.xml.stream.XMLEventWriter- Parameters:
prefix- the prefix to bind to the uriuri- the uri to bind to the prefix- Throws:
javax.xml.stream.XMLStreamException
-
-