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 XMLEventWriter
XMLStreamException
public void close() throws XMLStreamException
close
in interface XMLEventWriter
XMLStreamException
public void add(XMLEventReader eventReader) throws XMLStreamException
add
in interface XMLEventWriter
eventReader
- XMLStreamException
public void add(XMLEvent event) throws XMLStreamException
add
in interface XMLEventConsumer
add
in interface XMLEventWriter
event
- XMLStreamException
public String getPrefix(String uri) throws XMLStreamException
getPrefix
in interface XMLEventWriter
uri
- the uri to look upXMLStreamException
public NamespaceContext getNamespaceContext()
getNamespaceContext
in interface XMLEventWriter
public void setDefaultNamespace(String uri) throws XMLStreamException
setDefaultNamespace
in interface XMLEventWriter
uri
- the uri to bind to the default namespaceXMLStreamException
public void setNamespaceContext(NamespaceContext namespaceContext) throws XMLStreamException
setNamespaceContext
in interface XMLEventWriter
namespaceContext
- the namespace context to use for this writerXMLStreamException
public void setPrefix(String prefix, String uri) throws XMLStreamException
setPrefix
in interface XMLEventWriter
prefix
- the prefix to bind to the uriuri
- the uri to bind to the prefixXMLStreamException
Copyright © 2023 Oracle Corpration. All rights reserved.