javax.xml.stream

Interface XMLEventWriter

public interface XMLEventWriter extends XMLEventConsumer

Interface for writing XML documents from a series of events.
Method Summary
voidadd(XMLEvent event)
Adds the specified event to this writer.
voidadd(XMLEventReader reader)
Adds the specified XML stream to this writer.
voidclose()
Frees any resources used by this writer.
voidflush()
Ensures that any cached events are written to the underlying output sink.
NamespaceContextgetNamespaceContext()
Returns the namespace context.
StringgetPrefix(String uri)
Returns the namespace prefix the specified URI is currently associated with.
voidsetDefaultNamespace(String uri)
Sets the current default namespace URI.
voidsetNamespaceContext(NamespaceContext context)
Sets the namespace context for managing namespace prefixes and URIs.
voidsetPrefix(String prefix, String uri)
Associates the given namespace prefix and URI.

Method Detail

add

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

add

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

close

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

flush

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

getNamespaceContext

public NamespaceContext getNamespaceContext()
Returns the namespace context.

getPrefix

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

setDefaultNamespace

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

setNamespaceContext

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

setPrefix

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