javax.xml.stream
Interface XMLEventWriter

All Superinterfaces:
XMLEventConsumer

public interface XMLEventWriter
extends XMLEventConsumer

Interface for writing XML documents from a series of events.


Method Summary
 void add(XMLEvent event)
          Adds the specified event to this writer.
 void add(XMLEventReader reader)
          Adds the specified XML stream to this writer.
 void close()
          Frees any resources used by this writer.
 void flush()
          Ensures that any cached events are written to the underlying output sink.
 NamespaceContext getNamespaceContext()
          Returns the namespace context.
 String getPrefix(String uri)
          Returns the namespace prefix the specified URI is currently associated with.
 void setDefaultNamespace(String uri)
          Sets the current default namespace URI.
 void setNamespaceContext(NamespaceContext context)
          Sets the namespace context for managing namespace prefixes and URIs.
 void setPrefix(String prefix, String uri)
          Associates the given namespace prefix and URI.
 

Method Detail

flush

void flush()
           throws XMLStreamException
Ensures that any cached events are written to the underlying output sink.

Throws:
XMLStreamException

close

void close()
           throws XMLStreamException
Frees any resources used by this writer.

Throws:
XMLStreamException

add

void add(XMLEvent event)
         throws XMLStreamException
Adds the specified event to this writer.

Specified by:
add in interface XMLEventConsumer
Throws:
XMLStreamException

add

void add(XMLEventReader reader)
         throws XMLStreamException
Adds the specified XML stream to this writer. The implementation will call next on the given argument while hasNext returns true.

Throws:
XMLStreamException

getPrefix

String getPrefix(String uri)
                 throws XMLStreamException
Returns the namespace prefix the specified URI is currently associated with.

Throws:
XMLStreamException

setPrefix

void setPrefix(String prefix,
               String uri)
               throws XMLStreamException
Associates the given namespace prefix and URI.

Throws:
XMLStreamException

setDefaultNamespace

void setDefaultNamespace(String uri)
                         throws XMLStreamException
Sets the current default namespace URI.

Throws:
XMLStreamException

setNamespaceContext

void setNamespaceContext(NamespaceContext context)
                         throws XMLStreamException
Sets the namespace context for managing namespace prefixes and URIs.

Throws:
XMLStreamException

getNamespaceContext

NamespaceContext getNamespaceContext()
Returns the namespace context.