Package org.codehaus.stax2.ri
Class Stax2EventWriterImpl
- java.lang.Object
-
- org.codehaus.stax2.ri.Stax2EventWriterImpl
-
- All Implemented Interfaces:
XMLEventConsumer,XMLEventWriter,XMLStreamConstants
public class Stax2EventWriterImpl extends Object implements XMLEventWriter, XMLStreamConstants
Simple implementation ofXMLEventWriter.
-
-
Field Summary
Fields Modifier and Type Field Description protected XMLStreamWriter2_writer-
Fields inherited from interface javax.xml.stream.XMLStreamConstants
ATTRIBUTE, CDATA, CHARACTERS, COMMENT, DTD, END_DOCUMENT, END_ELEMENT, ENTITY_DECLARATION, ENTITY_REFERENCE, NAMESPACE, NOTATION_DECLARATION, PROCESSING_INSTRUCTION, SPACE, START_DOCUMENT, START_ELEMENT
-
-
Constructor Summary
Constructors Constructor Description Stax2EventWriterImpl(XMLStreamWriter2 sw)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(XMLEvent event)Basic implementation of the method which will use event implementations available as part of the reference implementation.voidadd(XMLEventReader reader)voidclose()voidflush()NamespaceContextgetNamespaceContext()StringgetPrefix(String uri)voidsetDefaultNamespace(String uri)voidsetNamespaceContext(NamespaceContext ctxt)voidsetPrefix(String prefix, String uri)
-
-
-
Field Detail
-
_writer
protected final XMLStreamWriter2 _writer
-
-
Constructor Detail
-
Stax2EventWriterImpl
public Stax2EventWriterImpl(XMLStreamWriter2 sw)
-
-
Method Detail
-
add
public void add(XMLEvent event) throws XMLStreamException
Basic implementation of the method which will use event implementations available as part of the reference implementation.Note: ALL events (except for custom ones ref. impl. itself doesn't produce, and thus may not always be able to deal with) are routed through stream writer. This because it may want to do different kinds of validation
- Specified by:
addin interfaceXMLEventConsumer- Specified by:
addin interfaceXMLEventWriter- Throws:
XMLStreamException
-
add
public void add(XMLEventReader reader) throws XMLStreamException
- Specified by:
addin interfaceXMLEventWriter- Throws:
XMLStreamException
-
close
public void close() throws XMLStreamException- Specified by:
closein interfaceXMLEventWriter- Throws:
XMLStreamException
-
flush
public void flush() throws XMLStreamException- Specified by:
flushin interfaceXMLEventWriter- Throws:
XMLStreamException
-
getNamespaceContext
public NamespaceContext getNamespaceContext()
- Specified by:
getNamespaceContextin interfaceXMLEventWriter
-
getPrefix
public String getPrefix(String uri) throws XMLStreamException
- Specified by:
getPrefixin interfaceXMLEventWriter- Throws:
XMLStreamException
-
setDefaultNamespace
public void setDefaultNamespace(String uri) throws XMLStreamException
- Specified by:
setDefaultNamespacein interfaceXMLEventWriter- Throws:
XMLStreamException
-
setNamespaceContext
public void setNamespaceContext(NamespaceContext ctxt) throws XMLStreamException
- Specified by:
setNamespaceContextin interfaceXMLEventWriter- Throws:
XMLStreamException
-
setPrefix
public void setPrefix(String prefix, String uri) throws XMLStreamException
- Specified by:
setPrefixin interfaceXMLEventWriter- Throws:
XMLStreamException
-
-