Package com.sun.xml.rpc.streaming
Class StAXWriter
- java.lang.Object
-
- com.sun.xml.rpc.streaming.XMLWriterBase
-
- com.sun.xml.rpc.streaming.StAXWriter
-
- All Implemented Interfaces:
XMLWriter
public class StAXWriter extends XMLWriterBase
An implementation of XMLWriter that uses StAX
-
-
Constructor Summary
Constructors Constructor Description StAXWriter(OutputStream out, String enc, boolean declare)StAXWriter(OutputStream out, String enc, boolean declare, XMLStreamWriter writer)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Close the writer and its underlying stream.voidendElement()Write the end tag for the current element.voidflush()Flush the writer and its underlying stream.StringgetPrefix(String uri)Return a prefix for the given URI.PrefixFactorygetPrefixFactory()Return the prefix factory in use by this writer.StringgetURI(String prefix)Return the URI for a given prefix.XMLStreamWritergetXMLStreamWriter()Returns the StAX XMLStreamWriter that is being used.voidsetPrefixFactory(PrefixFactory factory)Set the prefix factory to be used by this writer.voidstartElement(String localName, String uri)Write the start tag for an element.voidstartElement(String localName, String uri, String prefix)Write the start tag for an element.voidwriteAttribute(String localName, String uri, String value)Write an attribute of the current element.voidwriteAttributeUnquoted(String localName, String uri, String value)Write an attribute (unquoted) of the current element.voidwriteChars(CDATA chars)Write character data within an element.voidwriteChars(String chars)Write character data within an element.voidwriteCharsUnquoted(char[] buf, int offset, int len)If the first character of the string is an opening bracket, then this method assumes that the string is xml and it parses the string to write out the correct xml representation.voidwriteCharsUnquoted(String chars)If the first character of the string is an opening bracket, then this method assumes that the string is xml and it parses the string to write out the correct xml representation.voidwriteComment(String comment)Write a comment within an element.voidwriteNamespaceDeclaration(String uri)Write a namespace declaration of the current element.voidwriteNamespaceDeclaration(String prefix, String uri)Write a namespace declaration of the current element.-
Methods inherited from class com.sun.xml.rpc.streaming.XMLWriterBase
startElement, startElement, startElement, writeAttribute, writeAttribute, writeAttributeUnquoted, writeAttributeUnquoted
-
-
-
-
Constructor Detail
-
StAXWriter
public StAXWriter(OutputStream out, String enc, boolean declare)
-
StAXWriter
public StAXWriter(OutputStream out, String enc, boolean declare, XMLStreamWriter writer)
-
-
Method Detail
-
getXMLStreamWriter
public XMLStreamWriter getXMLStreamWriter()
Returns the StAX XMLStreamWriter that is being used.
-
startElement
public void startElement(String localName, String uri)
Description copied from interface:XMLWriterWrite the start tag for an element.
-
startElement
public void startElement(String localName, String uri, String prefix)
Description copied from interface:XMLWriterWrite the start tag for an element.
-
writeAttribute
public void writeAttribute(String localName, String uri, String value)
Description copied from interface:XMLWriterWrite an attribute of the current element.
-
writeAttributeUnquoted
public void writeAttributeUnquoted(String localName, String uri, String value)
Description copied from interface:XMLWriterWrite an attribute (unquoted) of the current element.
-
writeChars
public void writeChars(String chars)
Description copied from interface:XMLWriterWrite character data within an element.- Specified by:
writeCharsin interfaceXMLWriter- Specified by:
writeCharsin classXMLWriterBase
-
writeChars
public void writeChars(CDATA chars)
Description copied from interface:XMLWriterWrite character data within an element.- Specified by:
writeCharsin interfaceXMLWriter- Specified by:
writeCharsin classXMLWriterBase
-
writeCharsUnquoted
public void writeCharsUnquoted(String chars)
If the first character of the string is an opening bracket, then this method assumes that the string is xml and it parses the string to write out the correct xml representation. This is because there is no api in stax to write unescaped characters.
-
writeCharsUnquoted
public void writeCharsUnquoted(char[] buf, int offset, int len)If the first character of the string is an opening bracket, then this method assumes that the string is xml and it parses the string to write out the correct xml representation. This is because there is no api in stax to write unescaped characters.
-
writeComment
public void writeComment(String comment)
Description copied from interface:XMLWriterWrite a comment within an element.- Specified by:
writeCommentin interfaceXMLWriter- Overrides:
writeCommentin classXMLWriterBase
-
writeNamespaceDeclaration
public void writeNamespaceDeclaration(String prefix, String uri)
Description copied from interface:XMLWriterWrite a namespace declaration of the current element.
-
writeNamespaceDeclaration
public void writeNamespaceDeclaration(String uri)
Description copied from interface:XMLWriterWrite a namespace declaration of the current element. The prefix name will be generated by the PrefixFactory currently configured for this writer.
-
endElement
public void endElement()
Description copied from interface:XMLWriterWrite the end tag for the current element.
-
close
public void close()
Description copied from interface:XMLWriterClose the writer and its underlying stream.
-
flush
public void flush()
Description copied from interface:XMLWriterFlush the writer and its underlying stream.
-
getPrefix
public String getPrefix(String uri)
Description copied from interface:XMLWriterReturn a prefix for the given URI.If no prefix for the given URI is in scope, return null.
-
getURI
public String getURI(String prefix)
Description copied from interface:XMLWriterReturn the URI for a given prefix. If the prefix is undeclared, return null.
-
getPrefixFactory
public PrefixFactory getPrefixFactory()
Description copied from interface:XMLWriterReturn the prefix factory in use by this writer.
-
setPrefixFactory
public void setPrefixFactory(PrefixFactory factory)
Description copied from interface:XMLWriterSet the prefix factory to be used by this writer.
-
-