com.sun.xml.fastinfoset.stax.events
Class StAXEventWriter

java.lang.Object
  extended bycom.sun.xml.fastinfoset.stax.events.StAXEventWriter
All Implemented Interfaces:
javax.xml.stream.util.XMLEventConsumer, javax.xml.stream.XMLEventWriter

public class StAXEventWriter
extends java.lang.Object
implements javax.xml.stream.XMLEventWriter


Constructor Summary
StAXEventWriter(javax.xml.stream.XMLStreamWriter streamWriter)
           
 
Method Summary
 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
 javax.xml.namespace.NamespaceContext getNamespaceContext()
          Returns the current namespace context.
 java.lang.String getPrefix(java.lang.String uri)
          Gets the prefix the uri is bound to
 void setDefaultNamespace(java.lang.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(javax.xml.namespace.NamespaceContext namespaceContext)
          Sets the current namespace context for prefix and uri bindings.
 void setPrefix(java.lang.String prefix, java.lang.String uri)
          Sets the prefix the uri is bound to.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StAXEventWriter

public StAXEventWriter(javax.xml.stream.XMLStreamWriter streamWriter)
Parameters:
streamWriter -
Method Detail

flush

public void flush()
           throws javax.xml.stream.XMLStreamException
Writes any cached events to the underlying output mechanism

Specified by:
flush in interface javax.xml.stream.XMLEventWriter
Throws:
javax.xml.stream.XMLStreamException

close

public void close()
           throws javax.xml.stream.XMLStreamException
Frees any resources associated with this stream

Specified by:
close in interface javax.xml.stream.XMLEventWriter
Throws:
javax.xml.stream.XMLStreamException

add

public void add(javax.xml.stream.XMLEventReader eventReader)
         throws javax.xml.stream.XMLStreamException
Specified by:
add in interface javax.xml.stream.XMLEventWriter
Parameters:
eventReader -
Throws:
javax.xml.stream.XMLStreamException

add

public void add(javax.xml.stream.events.XMLEvent event)
         throws javax.xml.stream.XMLStreamException
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.

Specified by:
add in interface javax.xml.stream.XMLEventWriter
Parameters:
event -
Throws:
javax.xml.stream.XMLStreamException

getPrefix

public java.lang.String getPrefix(java.lang.String uri)
                           throws javax.xml.stream.XMLStreamException
Gets the prefix the uri is bound to

Specified by:
getPrefix in interface javax.xml.stream.XMLEventWriter
Parameters:
uri - the uri to look up
Throws:
javax.xml.stream.XMLStreamException

getNamespaceContext

public javax.xml.namespace.NamespaceContext getNamespaceContext()
Returns the current namespace context.

Specified by:
getNamespaceContext in interface javax.xml.stream.XMLEventWriter
Returns:
the current namespace context

setDefaultNamespace

public void setDefaultNamespace(java.lang.String uri)
                         throws javax.xml.stream.XMLStreamException
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.

Specified by:
setDefaultNamespace in interface javax.xml.stream.XMLEventWriter
Parameters:
uri - the uri to bind to the default namespace
Throws:
javax.xml.stream.XMLStreamException

setNamespaceContext

public void setNamespaceContext(javax.xml.namespace.NamespaceContext namespaceContext)
                         throws javax.xml.stream.XMLStreamException
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.

Specified by:
setNamespaceContext in interface javax.xml.stream.XMLEventWriter
Parameters:
namespaceContext - the namespace context to use for this writer
Throws:
javax.xml.stream.XMLStreamException

setPrefix

public void setPrefix(java.lang.String prefix,
                      java.lang.String uri)
               throws javax.xml.stream.XMLStreamException
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.

Specified by:
setPrefix in interface javax.xml.stream.XMLEventWriter
Parameters:
prefix - the prefix to bind to the uri
uri - the uri to bind to the prefix
Throws:
javax.xml.stream.XMLStreamException