public class StAXEventWriter extends Object implements XMLEventWriter
| Constructor and Description |
|---|
StAXEventWriter(XMLStreamWriter streamWriter) |
| Modifier and Type | Method and Description |
|---|---|
void |
add(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.
|
void |
add(XMLEventReader eventReader) |
void |
close()
Frees any resources associated with this stream
|
void |
flush()
Writes any cached events to the underlying output mechanism
|
NamespaceContext |
getNamespaceContext()
Returns the current namespace context.
|
String |
getPrefix(String uri)
Gets the prefix the uri is bound to
|
void |
setDefaultNamespace(String uri)
Binds a URI to the default namespace
This URI is bound
in the scope of the current START_ELEMENT / END_ELEMENT pair.
|
void |
setNamespaceContext(NamespaceContext namespaceContext)
Sets the current namespace context for prefix and uri bindings.
|
void |
setPrefix(String prefix,
String uri)
Sets the prefix the uri is bound to.
|
public StAXEventWriter(XMLStreamWriter streamWriter)
streamWriter - public void flush()
throws XMLStreamException
flush in interface XMLEventWriterXMLStreamExceptionpublic void close()
throws XMLStreamException
close in interface XMLEventWriterXMLStreamExceptionpublic void add(XMLEventReader eventReader) throws XMLStreamException
add in interface XMLEventWritereventReader - XMLStreamExceptionpublic void add(XMLEvent event) throws XMLStreamException
add in interface XMLEventConsumeradd in interface XMLEventWriterevent - XMLStreamExceptionpublic String getPrefix(String uri) throws XMLStreamException
getPrefix in interface XMLEventWriteruri - the uri to look upXMLStreamExceptionpublic NamespaceContext getNamespaceContext()
getNamespaceContext in interface XMLEventWriterpublic void setDefaultNamespace(String uri) throws XMLStreamException
setDefaultNamespace in interface XMLEventWriteruri - the uri to bind to the default namespaceXMLStreamExceptionpublic void setNamespaceContext(NamespaceContext namespaceContext) throws XMLStreamException
setNamespaceContext in interface XMLEventWriternamespaceContext - the namespace context to use for this writerXMLStreamExceptionpublic void setPrefix(String prefix, String uri) throws XMLStreamException
setPrefix in interface XMLEventWriterprefix - the prefix to bind to the uriuri - the uri to bind to the prefixXMLStreamExceptionCopyright © 2005–2017 Oracle Corporation. All rights reserved.