Class StAXEventWriter
java.lang.Object
com.sun.xml.fastinfoset.stax.events.StAXEventWriter
- All Implemented Interfaces:
XMLEventConsumer,XMLEventWriter
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd 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.voidadd(XMLEventReader eventReader) voidclose()Frees any resources associated with this streamvoidflush()Writes any cached events to the underlying output mechanismReturns the current namespace context.Gets the prefix the uri is bound tovoidBinds a URI to the default namespace This URI is bound in the scope of the current START_ELEMENT / END_ELEMENT pair.voidsetNamespaceContext(NamespaceContext namespaceContext) Sets the current namespace context for prefix and uri bindings.voidSets the prefix the uri is bound to.
-
Constructor Details
-
StAXEventWriter
- Parameters:
streamWriter-
-
-
Method Details
-
flush
Writes any cached events to the underlying output mechanism- Specified by:
flushin interfaceXMLEventWriter- Throws:
XMLStreamException
-
close
Frees any resources associated with this stream- Specified by:
closein interfaceXMLEventWriter- Throws:
XMLStreamException
-
add
- Specified by:
addin interfaceXMLEventWriter- Parameters:
eventReader-- Throws:
XMLStreamException
-
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.- Specified by:
addin interfaceXMLEventConsumer- Specified by:
addin interfaceXMLEventWriter- Parameters:
event-- Throws:
XMLStreamException
-
getPrefix
Gets the prefix the uri is bound to- Specified by:
getPrefixin interfaceXMLEventWriter- Parameters:
uri- the uri to look up- Throws:
XMLStreamException
-
getNamespaceContext
Returns the current namespace context.- Specified by:
getNamespaceContextin interfaceXMLEventWriter- Returns:
- the current namespace context
-
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.- Specified by:
setDefaultNamespacein interfaceXMLEventWriter- Parameters:
uri- the uri to bind to the default namespace- Throws:
XMLStreamException
-
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.- Specified by:
setNamespaceContextin interfaceXMLEventWriter- Parameters:
namespaceContext- the namespace context to use for this writer- Throws:
XMLStreamException
-
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.- Specified by:
setPrefixin interfaceXMLEventWriter- Parameters:
prefix- the prefix to bind to the uriuri- the uri to bind to the prefix- Throws:
XMLStreamException
-