public class GsonXMLStreamWriter extends Object implements javax.xml.stream.XMLStreamWriter
| Constructor and Description |
|---|
GsonXMLStreamWriter(com.google.gson.stream.JsonWriter jsonWriter,
QName elementQName,
List<org.apache.ws.commons.schema.XmlSchema> xmlSchemaList,
org.apache.axis2.context.ConfigurationContext context) |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Close this writer and free any resources associated with the
writer.
|
void |
flush()
Write any cached data to the underlying output mechanism.
|
NamespaceContext |
getNamespaceContext()
Returns the current namespace context.
|
String |
getPrefix(String uri)
Gets the prefix the uri is bound to
|
Object |
getProperty(String name)
Get the value of a feature/property from the underlying implementation
|
void |
setDefaultNamespace(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(NamespaceContext context)
Sets the current namespace context for prefix and uri bindings.
|
void |
setPrefix(String prefix,
String uri)
Sets the prefix the uri is bound to.
|
void |
writeAttribute(String localName,
String value)
Writes an attribute to the output stream without
a prefix.
|
void |
writeAttribute(String namespaceURI,
String localName,
String value)
Writes an attribute to the output stream
|
void |
writeAttribute(String prefix,
String namespaceURI,
String localName,
String value)
Writes an attribute to the output stream
|
void |
writeCData(String data)
Writes a CData section
|
void |
writeCharacters(char[] text,
int start,
int len)
Write text to the output
|
void |
writeCharacters(String text)
Write text to the output
|
void |
writeComment(String data)
Writes an xml comment with the data enclosed
|
void |
writeDefaultNamespace(String namespaceURI)
Writes the default namespace to the stream
|
void |
writeDTD(String dtd)
Write a DTD section.
|
void |
writeEmptyElement(String localName)
Writes an empty element tag to the output
|
void |
writeEmptyElement(String namespaceURI,
String localName)
Writes an empty element tag to the output
|
void |
writeEmptyElement(String prefix,
String localName,
String namespaceURI)
Writes an empty element tag to the output
|
void |
writeEndDocument()
Closes any start tags and writes corresponding end tags.
|
void |
writeEndElement()
Writes an end tag to the output relying on the internal
state of the writer to determine the prefix and local name
of the event.
|
void |
writeEntityRef(String name)
Writes an entity reference
|
void |
writeNamespace(String prefix,
String namespaceURI)
Writes a namespace to the output stream
If the prefix argument to this method is the empty string,
"xmlns", or null this method will delegate to writeDefaultNamespace
|
void |
writeProcessingInstruction(String target)
Writes a processing instruction
|
void |
writeProcessingInstruction(String target,
String data)
Writes a processing instruction
|
void |
writeStartDocument()
Write the XML Declaration.
|
void |
writeStartDocument(String version)
Write the XML Declaration.
|
void |
writeStartDocument(String encoding,
String version)
Write the XML Declaration.
|
void |
writeStartElement(String localName)
Writes a start tag to the output.
|
void |
writeStartElement(String namespaceURI,
String localName)
Writes a start tag to the output
|
void |
writeStartElement(String prefix,
String localName,
String namespaceURI)
Writes a start tag to the output
|
public void writeStartElement(String localName) throws javax.xml.stream.XMLStreamException
writeStartElement in interface javax.xml.stream.XMLStreamWriterlocalName - local name of the tag, may not be nulljavax.xml.stream.XMLStreamExceptionpublic void writeStartElement(String namespaceURI, String localName) throws javax.xml.stream.XMLStreamException
writeStartElement in interface javax.xml.stream.XMLStreamWriternamespaceURI - the namespaceURI of the prefix to use, may not be nulllocalName - local name of the tag, may not be nulljavax.xml.stream.XMLStreamException - if the namespace URI has not been bound to a prefix and
javax.xml.stream.isRepairingNamespaces has not been set to truepublic void writeStartElement(String prefix, String localName, String namespaceURI) throws javax.xml.stream.XMLStreamException
writeStartElement in interface javax.xml.stream.XMLStreamWriterlocalName - local name of the tag, may not be nullprefix - the prefix of the tag, may not be nullnamespaceURI - the uri to bind the prefix to, may not be nulljavax.xml.stream.XMLStreamExceptionpublic void writeEmptyElement(String namespaceURI, String localName) throws javax.xml.stream.XMLStreamException
writeEmptyElement in interface javax.xml.stream.XMLStreamWriternamespaceURI - the uri to bind the tag to, may not be nulllocalName - local name of the tag, may not be nulljavax.xml.stream.XMLStreamException - if the namespace URI has not been bound to a prefix and
javax.xml.stream.isRepairingNamespaces has not been set to truepublic void writeEmptyElement(String prefix, String localName, String namespaceURI) throws javax.xml.stream.XMLStreamException
writeEmptyElement in interface javax.xml.stream.XMLStreamWriterprefix - the prefix of the tag, may not be nulllocalName - local name of the tag, may not be nullnamespaceURI - the uri to bind the tag to, may not be nulljavax.xml.stream.XMLStreamExceptionpublic void writeEmptyElement(String localName) throws javax.xml.stream.XMLStreamException
writeEmptyElement in interface javax.xml.stream.XMLStreamWriterlocalName - local name of the tag, may not be nulljavax.xml.stream.XMLStreamExceptionpublic void writeEndElement()
throws javax.xml.stream.XMLStreamException
writeEndElement in interface javax.xml.stream.XMLStreamWriterjavax.xml.stream.XMLStreamExceptionpublic void writeEndDocument()
throws javax.xml.stream.XMLStreamException
writeEndDocument in interface javax.xml.stream.XMLStreamWriterjavax.xml.stream.XMLStreamExceptionpublic void close()
throws javax.xml.stream.XMLStreamException
close in interface javax.xml.stream.XMLStreamWriterjavax.xml.stream.XMLStreamExceptionpublic void flush()
throws javax.xml.stream.XMLStreamException
flush in interface javax.xml.stream.XMLStreamWriterjavax.xml.stream.XMLStreamExceptionpublic void writeAttribute(String localName, String value) throws javax.xml.stream.XMLStreamException
writeAttribute in interface javax.xml.stream.XMLStreamWriterlocalName - the local name of the attributevalue - the value of the attributeIllegalStateException - if the current state does not allow Attribute writingjavax.xml.stream.XMLStreamExceptionpublic void writeAttribute(String prefix, String namespaceURI, String localName, String value) throws javax.xml.stream.XMLStreamException
writeAttribute in interface javax.xml.stream.XMLStreamWriterprefix - the prefix for this attributenamespaceURI - the uri of the prefix for this attributelocalName - the local name of the attributevalue - the value of the attributeIllegalStateException - if the current state does not allow Attribute writingjavax.xml.stream.XMLStreamException - if the namespace URI has not been bound to a prefix and
javax.xml.stream.isRepairingNamespaces has not been set to truepublic void writeAttribute(String namespaceURI, String localName, String value) throws javax.xml.stream.XMLStreamException
writeAttribute in interface javax.xml.stream.XMLStreamWriternamespaceURI - the uri of the prefix for this attributelocalName - the local name of the attributevalue - the value of the attributeIllegalStateException - if the current state does not allow Attribute writingjavax.xml.stream.XMLStreamException - if the namespace URI has not been bound to a prefix and
javax.xml.stream.isRepairingNamespaces has not been set to truepublic void writeNamespace(String prefix, String namespaceURI) throws javax.xml.stream.XMLStreamException
writeNamespace in interface javax.xml.stream.XMLStreamWriterprefix - the prefix to bind this namespace tonamespaceURI - the uri to bind the prefix toIllegalStateException - if the current state does not allow Namespace writingjavax.xml.stream.XMLStreamExceptionpublic void writeDefaultNamespace(String namespaceURI) throws javax.xml.stream.XMLStreamException
writeDefaultNamespace in interface javax.xml.stream.XMLStreamWriternamespaceURI - the uri to bind the default namespace toIllegalStateException - if the current state does not allow Namespace writingjavax.xml.stream.XMLStreamExceptionpublic void writeComment(String data) throws javax.xml.stream.XMLStreamException
writeComment in interface javax.xml.stream.XMLStreamWriterdata - the data contained in the comment, may be nulljavax.xml.stream.XMLStreamExceptionpublic void writeProcessingInstruction(String target) throws javax.xml.stream.XMLStreamException
writeProcessingInstruction in interface javax.xml.stream.XMLStreamWritertarget - the target of the processing instruction, may not be nulljavax.xml.stream.XMLStreamExceptionpublic void writeProcessingInstruction(String target, String data) throws javax.xml.stream.XMLStreamException
writeProcessingInstruction in interface javax.xml.stream.XMLStreamWritertarget - the target of the processing instruction, may not be nulldata - the data contained in the processing instruction, may not be nulljavax.xml.stream.XMLStreamExceptionpublic void writeCData(String data) throws javax.xml.stream.XMLStreamException
writeCData in interface javax.xml.stream.XMLStreamWriterdata - the data contained in the CData Section, may not be nulljavax.xml.stream.XMLStreamExceptionpublic void writeDTD(String dtd) throws javax.xml.stream.XMLStreamException
writeDTD in interface javax.xml.stream.XMLStreamWriterdtd - the DTD to be writtenjavax.xml.stream.XMLStreamExceptionpublic void writeEntityRef(String name) throws javax.xml.stream.XMLStreamException
writeEntityRef in interface javax.xml.stream.XMLStreamWritername - the name of the entityjavax.xml.stream.XMLStreamExceptionpublic void writeStartDocument()
throws javax.xml.stream.XMLStreamException
writeStartDocument in interface javax.xml.stream.XMLStreamWriterjavax.xml.stream.XMLStreamExceptionpublic void writeStartDocument(String version) throws javax.xml.stream.XMLStreamException
writeStartDocument in interface javax.xml.stream.XMLStreamWriterversion - version of the xml documentjavax.xml.stream.XMLStreamExceptionpublic void writeStartDocument(String encoding, String version) throws javax.xml.stream.XMLStreamException
writeStartDocument in interface javax.xml.stream.XMLStreamWriterencoding - encoding of the xml declarationversion - version of the xml documentjavax.xml.stream.XMLStreamException - If given encoding does not match encoding
of the underlying streampublic void writeCharacters(String text) throws javax.xml.stream.XMLStreamException
writeCharacters in interface javax.xml.stream.XMLStreamWritertext - the value to writejavax.xml.stream.XMLStreamExceptionpublic void writeCharacters(char[] text,
int start,
int len)
throws javax.xml.stream.XMLStreamException
writeCharacters in interface javax.xml.stream.XMLStreamWritertext - the value to writestart - the starting position in the arraylen - the number of characters to writejavax.xml.stream.XMLStreamExceptionpublic String getPrefix(String uri) throws javax.xml.stream.XMLStreamException
getPrefix in interface javax.xml.stream.XMLStreamWriterjavax.xml.stream.XMLStreamExceptionpublic void setPrefix(String prefix, String uri) throws javax.xml.stream.XMLStreamException
setPrefix in interface javax.xml.stream.XMLStreamWriterprefix - the prefix to bind to the uri, may not be nulluri - the uri to bind to the prefix, may be nulljavax.xml.stream.XMLStreamExceptionpublic void setDefaultNamespace(String uri) throws javax.xml.stream.XMLStreamException
setDefaultNamespace in interface javax.xml.stream.XMLStreamWriteruri - the uri to bind to the default namespace, may be nulljavax.xml.stream.XMLStreamExceptionpublic void setNamespaceContext(NamespaceContext context) throws javax.xml.stream.XMLStreamException
setNamespaceContext in interface javax.xml.stream.XMLStreamWritercontext - the namespace context to use for this writer, may not be nulljavax.xml.stream.XMLStreamExceptionpublic NamespaceContext getNamespaceContext()
getNamespaceContext in interface javax.xml.stream.XMLStreamWriterpublic Object getProperty(String name) throws IllegalArgumentException
getProperty in interface javax.xml.stream.XMLStreamWritername - The name of the property, may not be nullIllegalArgumentException - if the property is not supportedNullPointerException - if the name is nullCopyright © 2004–2016 The Apache Software Foundation. All rights reserved.