Top Fields Constructors Methods
com.sun.xml.fastinfoset.stax.events

public Class StAXEventWriter

extends Object
implements XMLEventWriter
Class Inheritance
All Implemented Interfaces
javax.xml.stream.XMLEventWriter, javax.xml.stream.util.XMLEventConsumer
Imports
java.util.Iterator, javax.xml.namespace.QName, .NamespaceContext, javax.xml.stream.XMLEventWriter, .XMLEventReader, .XMLStreamConstants, .XMLStreamWriter, .XMLStreamException, javax.xml.stream.events.*, com.sun.xml.fastinfoset.CommonResourceBundle

Field Summary

Modifier and TypeField and Description
private final XMLStreamWriter

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
add(XMLEventReader eventReader)

Implements javax.xml.stream.XMLEventWriter.add.

Adds an entire stream to an output stream, calls next() on the inputStream argument until hasNext() returns false This should be treated as a convenience method that will perform the following loop over all the events in an event reader and call add on each event.

public void
add(XMLEvent event)

Implements javax.xml.stream.XMLEventWriter.add.

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.

public void
close()

Implements javax.xml.stream.XMLEventWriter.close.

Frees any resources associated with this stream

public void
flush()

Implements javax.xml.stream.XMLEventWriter.flush.

Writes any cached events to the underlying output mechanism

public NamespaceContext

Returns:

the current namespace context
getNamespaceContext
()

Implements javax.xml.stream.XMLEventWriter.getNamespaceContext.

Returns the current namespace context.

public String
getPrefix(String
the uri to look up
uri
)

Implements javax.xml.stream.XMLEventWriter.getPrefix.

Gets the prefix the uri is bound to

public void
setDefaultNamespace(String
the uri to bind to the default namespace
uri
)

Implements javax.xml.stream.XMLEventWriter.setDefaultNamespace.

Binds a URI to the default namespace This URI is bound in the scope of the current START_ELEMENT / END_ELEMENT pair.

public void
setNamespaceContext(NamespaceContext
the namespace context to use for this writer
namespaceContext
)

Implements javax.xml.stream.XMLEventWriter.setNamespaceContext.

Sets the current namespace context for prefix and uri bindings.

public void
setPrefix(String
the prefix to bind to the uri
prefix
,
String
the uri to bind to the prefix
uri
)

Implements javax.xml.stream.XMLEventWriter.setPrefix.

Sets the prefix the uri is bound to.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

_streamWriterback to summary
private final XMLStreamWriter _streamWriter

Constructor Detail

StAXEventWriterback to summary
public StAXEventWriter(XMLStreamWriter streamWriter)

Method Detail

addback to summary
public void add(XMLEventReader eventReader) throws XMLStreamException

Implements javax.xml.stream.XMLEventWriter.add.

Doc from javax.xml.stream.XMLEventWriter.add.

Adds an entire stream to an output stream, calls next() on the inputStream argument until hasNext() returns false This should be treated as a convenience method that will perform the following loop over all the events in an event reader and call add on each event.

Annotations
@Override
Exceptions
XMLStreamException:
if an error occurs
addback to summary
public void add(XMLEvent event) throws XMLStreamException

Implements javax.xml.stream.XMLEventWriter.add.

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.

Annotations
@Override
Exceptions
XMLStreamException:

Doc from javax.xml.stream.XMLEventWriter.add.

if an error occurs

closeback to summary
public void close() throws XMLStreamException

Implements javax.xml.stream.XMLEventWriter.close.

Frees any resources associated with this stream

Annotations
@Override
Exceptions
XMLStreamException:

Doc from javax.xml.stream.XMLEventWriter.close.

if an error occurs

flushback to summary
public void flush() throws XMLStreamException

Implements javax.xml.stream.XMLEventWriter.flush.

Writes any cached events to the underlying output mechanism

Annotations
@Override
Exceptions
XMLStreamException:

Doc from javax.xml.stream.XMLEventWriter.flush.

if an error occurs

getNamespaceContextback to summary
public NamespaceContext getNamespaceContext()

Implements javax.xml.stream.XMLEventWriter.getNamespaceContext.

Returns the current namespace context.

Returns:NamespaceContext

the current namespace context

Annotations
@Override
getPrefixback to summary
public String getPrefix(String uri) throws XMLStreamException

Implements javax.xml.stream.XMLEventWriter.getPrefix.

Gets the prefix the uri is bound to

Parameters
uri:String

the uri to look up

Annotations
@Override
Exceptions
XMLStreamException:

Doc from javax.xml.stream.XMLEventWriter.getPrefix.

if an error occurs

setDefaultNamespaceback to summary
public void setDefaultNamespace(String uri) throws XMLStreamException

Implements javax.xml.stream.XMLEventWriter.setDefaultNamespace.

Binds a URI to the default namespace This URI is bound in the scope of the current START_ELEMENT / END_ELEMENT pair. If this method is called before a START_ELEMENT has been written the uri is bound in the root scope.

Parameters
uri:String

the uri to bind to the default namespace

Annotations
@Override
Exceptions
XMLStreamException:

Doc from javax.xml.stream.XMLEventWriter.setDefaultNamespace.

if an error occurs

setNamespaceContextback to summary
public void setNamespaceContext(NamespaceContext namespaceContext) throws XMLStreamException

Implements javax.xml.stream.XMLEventWriter.setNamespaceContext.

Sets the current namespace context for prefix and uri bindings. This context becomes the root namespace context for writing and will replace the current root namespace context. Subsequent calls to setPrefix and setDefaultNamespace will bind namespaces using the context passed to the method as the root context for resolving namespaces.

Parameters
namespaceContext:NamespaceContext

the namespace context to use for this writer

Annotations
@Override
Exceptions
XMLStreamException:

Doc from javax.xml.stream.XMLEventWriter.setNamespaceContext.

if an error occurs

setPrefixback to summary
public void setPrefix(String prefix, String uri) throws XMLStreamException

Implements javax.xml.stream.XMLEventWriter.setPrefix.

Sets the prefix the uri is bound to. This prefix is bound in the scope of the current START_ELEMENT / END_ELEMENT pair. If this method is called before a START_ELEMENT has been written the prefix is bound in the root scope.

Parameters
prefix:String

the prefix to bind to the uri

uri:String

the uri to bind to the prefix

Annotations
@Override
Exceptions
XMLStreamException:

Doc from javax.xml.stream.XMLEventWriter.setPrefix.

if an error occurs