public class StAXEventWriter extends Object implements javax.xml.stream.XMLEventWriter
Constructor and Description |
---|
StAXEventWriter(javax.xml.stream.XMLStreamWriter streamWriter) |
Modifier and Type | Method and Description |
---|---|
void |
add(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.
|
void |
add(javax.xml.stream.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(javax.xml.stream.XMLStreamWriter streamWriter)
streamWriter
- public void flush() throws javax.xml.stream.XMLStreamException
flush
in interface javax.xml.stream.XMLEventWriter
javax.xml.stream.XMLStreamException
public void close() throws javax.xml.stream.XMLStreamException
close
in interface javax.xml.stream.XMLEventWriter
javax.xml.stream.XMLStreamException
public void add(javax.xml.stream.XMLEventReader eventReader) throws javax.xml.stream.XMLStreamException
add
in interface javax.xml.stream.XMLEventWriter
eventReader
- javax.xml.stream.XMLStreamException
public void add(javax.xml.stream.events.XMLEvent event) throws javax.xml.stream.XMLStreamException
add
in interface javax.xml.stream.util.XMLEventConsumer
add
in interface javax.xml.stream.XMLEventWriter
event
- javax.xml.stream.XMLStreamException
public String getPrefix(String uri) throws javax.xml.stream.XMLStreamException
getPrefix
in interface javax.xml.stream.XMLEventWriter
uri
- the uri to look upjavax.xml.stream.XMLStreamException
public NamespaceContext getNamespaceContext()
getNamespaceContext
in interface javax.xml.stream.XMLEventWriter
public void setDefaultNamespace(String uri) throws javax.xml.stream.XMLStreamException
setDefaultNamespace
in interface javax.xml.stream.XMLEventWriter
uri
- the uri to bind to the default namespacejavax.xml.stream.XMLStreamException
public void setNamespaceContext(NamespaceContext namespaceContext) throws javax.xml.stream.XMLStreamException
setNamespaceContext
in interface javax.xml.stream.XMLEventWriter
namespaceContext
- the namespace context to use for this writerjavax.xml.stream.XMLStreamException
public void setPrefix(String prefix, String uri) throws javax.xml.stream.XMLStreamException
setPrefix
in interface javax.xml.stream.XMLEventWriter
prefix
- the prefix to bind to the uriuri
- the uri to bind to the prefixjavax.xml.stream.XMLStreamException
Copyright © 2024 Oracle Corpration. All rights reserved.