|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjavanet.staxutils.io.StAXStreamWriter
public class StAXStreamWriter
An XMLStreamWriter implementation that writes to a character stream.
| Constructor Summary | |
|---|---|
StAXStreamWriter(OutputStream stream)
Constructs a StAXStreamWriter that writes to the provided
OutputStream using the platform default encoding. |
|
StAXStreamWriter(OutputStream stream,
String encoding)
Constructs a StAXStreamWriter that writes to the provided
OutputStream using the specified encoding. |
|
StAXStreamWriter(Writer writer)
Constructs a StAXStreamWriter that writes to the provided
Writer. |
|
StAXStreamWriter(Writer writer,
NamespaceContext rootContext)
Constructs a StAXStreamWriter that writes to the provided
Writer. |
|
| Method Summary | |
|---|---|
void |
close()
|
protected void |
closeElementContext()
Closes the current ElementContext, writing any cached content and
making it read-only. |
void |
flush()
|
String |
getCurrentPath()
Returns the current position of the writer as a path of QName strings. |
NamespaceContext |
getNamespaceContext()
|
String |
getPrefix(String uri)
|
Object |
getProperty(String name)
|
void |
setDefaultNamespace(String uri)
|
void |
setNamespaceContext(NamespaceContext context)
|
void |
setPrefix(String prefix,
String uri)
|
void |
writeAttribute(QName name,
String value)
|
void |
writeAttribute(String localName,
String value)
|
void |
writeAttribute(String namespaceURI,
String localName,
String value)
|
void |
writeAttribute(String prefix,
String namespaceURI,
String localName,
String value)
|
void |
writeCData(String data)
|
void |
writeCharacters(char[] text,
int start,
int len)
|
void |
writeCharacters(String text)
|
void |
writeComment(String data)
|
void |
writeDefaultNamespace(String namespaceURI)
|
void |
writeDTD(String dtd)
|
void |
writeEmptyElement(String localName)
|
void |
writeEmptyElement(String namespaceURI,
String localName)
|
void |
writeEmptyElement(String prefix,
String localName,
String namespaceURI)
|
void |
writeEndDocument()
|
void |
writeEndElement()
|
void |
writeEntityRef(String name)
|
void |
writeNamespace(String prefix,
String namespaceURI)
|
void |
writeProcessingInstruction(String target)
|
void |
writeProcessingInstruction(String target,
String data)
|
void |
writeStartDocument()
|
void |
writeStartDocument(String version)
|
void |
writeStartDocument(String encoding,
String version)
|
void |
writeStartElement(String localName)
|
void |
writeStartElement(String namespaceURI,
String localName)
|
void |
writeStartElement(String prefix,
String localName,
String namespaceURI)
|
void |
writeStartElement(String prefix,
String localName,
String namespaceURI,
boolean isEmpty)
Core start tag output method called by all other writeXXXElement
methods. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public StAXStreamWriter(OutputStream stream)
StAXStreamWriter that writes to the provided
OutputStream using the platform default encoding.
stream - The destination stream.
public StAXStreamWriter(OutputStream stream,
String encoding)
throws UnsupportedEncodingException
StAXStreamWriter that writes to the provided
OutputStream using the specified encoding.
stream - The destination stream.encoding - The output encoding.
UnsupportedEncodingException - If the encoding isn't supported.public StAXStreamWriter(Writer writer)
StAXStreamWriter that writes to the provided
Writer.
writer - The destination Writer instance.
public StAXStreamWriter(Writer writer,
NamespaceContext rootContext)
StAXStreamWriter that writes to the provided
Writer.
writer - The destination Writer instance.rootContext - The root namespace context.| Method Detail |
|---|
public void close()
throws XMLStreamException
close in interface XMLStreamWriterXMLStreamException
public void flush()
throws XMLStreamException
flush in interface XMLStreamWriterXMLStreamException
public String getPrefix(String uri)
throws XMLStreamException
getPrefix in interface XMLStreamWriterXMLStreamException
public Object getProperty(String name)
throws IllegalArgumentException
getProperty in interface XMLStreamWriterIllegalArgumentException
public void writeStartDocument()
throws XMLStreamException
writeStartDocument in interface XMLStreamWriterXMLStreamException
public void writeStartDocument(String version)
throws XMLStreamException
writeStartDocument in interface XMLStreamWriterXMLStreamException
public void writeStartDocument(String encoding,
String version)
throws XMLStreamException
writeStartDocument in interface XMLStreamWriterXMLStreamException
public void writeEndDocument()
throws XMLStreamException
writeEndDocument in interface XMLStreamWriterXMLStreamException
public void writeCData(String data)
throws XMLStreamException
writeCData in interface XMLStreamWriterXMLStreamException
public void writeCharacters(char[] text,
int start,
int len)
throws XMLStreamException
writeCharacters in interface XMLStreamWriterXMLStreamException
public void writeCharacters(String text)
throws XMLStreamException
writeCharacters in interface XMLStreamWriterXMLStreamException
public void writeComment(String data)
throws XMLStreamException
writeComment in interface XMLStreamWriterXMLStreamException
public void writeDTD(String dtd)
throws XMLStreamException
writeDTD in interface XMLStreamWriterXMLStreamException
public void writeEntityRef(String name)
throws XMLStreamException
writeEntityRef in interface XMLStreamWriterXMLStreamException
public void writeProcessingInstruction(String target,
String data)
throws XMLStreamException
writeProcessingInstruction in interface XMLStreamWriterXMLStreamException
public void writeProcessingInstruction(String target)
throws XMLStreamException
writeProcessingInstruction in interface XMLStreamWriterXMLStreamExceptionpublic NamespaceContext getNamespaceContext()
getNamespaceContext in interface XMLStreamWriter
public void setNamespaceContext(NamespaceContext context)
throws XMLStreamException
setNamespaceContext in interface XMLStreamWriterXMLStreamException
public void setDefaultNamespace(String uri)
throws XMLStreamException
setDefaultNamespace in interface XMLStreamWriterXMLStreamException
public void setPrefix(String prefix,
String uri)
throws XMLStreamException
setPrefix in interface XMLStreamWriterXMLStreamException
public void writeStartElement(String prefix,
String localName,
String namespaceURI,
boolean isEmpty)
throws XMLStreamException
writeXXXElement
methods.
prefix - The tag prefix.localName - The tag local name.namespaceURI - The namespace URI of the prefix.isEmpty - Whether the tag is empty.
XMLStreamException - If an error occurs writing the tag to the stream.
public void writeStartElement(String prefix,
String localName,
String namespaceURI)
throws XMLStreamException
writeStartElement in interface XMLStreamWriterXMLStreamException
public void writeStartElement(String namespaceURI,
String localName)
throws XMLStreamException
writeStartElement in interface XMLStreamWriterXMLStreamException
public void writeStartElement(String localName)
throws XMLStreamException
writeStartElement in interface XMLStreamWriterXMLStreamException
public void writeEmptyElement(String prefix,
String localName,
String namespaceURI)
throws XMLStreamException
writeEmptyElement in interface XMLStreamWriterXMLStreamException
public void writeEmptyElement(String namespaceURI,
String localName)
throws XMLStreamException
writeEmptyElement in interface XMLStreamWriterXMLStreamException
public void writeEmptyElement(String localName)
throws XMLStreamException
writeEmptyElement in interface XMLStreamWriterXMLStreamException
public void writeAttribute(QName name,
String value)
throws XMLStreamException
XMLStreamException
public void writeAttribute(String prefix,
String namespaceURI,
String localName,
String value)
throws XMLStreamException
writeAttribute in interface XMLStreamWriterXMLStreamException
public void writeAttribute(String namespaceURI,
String localName,
String value)
throws XMLStreamException
writeAttribute in interface XMLStreamWriterXMLStreamException
public void writeAttribute(String localName,
String value)
throws XMLStreamException
writeAttribute in interface XMLStreamWriterXMLStreamException
public void writeDefaultNamespace(String namespaceURI)
throws XMLStreamException
writeDefaultNamespace in interface XMLStreamWriterXMLStreamException
public void writeNamespace(String prefix,
String namespaceURI)
throws XMLStreamException
writeNamespace in interface XMLStreamWriterXMLStreamException
public void writeEndElement()
throws XMLStreamException
writeEndElement in interface XMLStreamWriterXMLStreamExceptionpublic String getCurrentPath()
QName strings.
protected void closeElementContext()
throws XMLStreamException
ElementContext, writing any cached content and
making it read-only. If the current context is empty, it will be popped and
replaced with its parent context. If no context is open, this method has no
effects.
XMLStreamException - If an error occurs flushing any element content.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||