javax.xml.stream

Interface XMLStreamWriter

public interface XMLStreamWriter

Interface for writing XML to a stream.
Method Summary
voidclose()
Frees any resources used by this writer.
voidflush()
Flushes any cached information to the underlying output sink.
NamespaceContextgetNamespaceContext()
Returns the current namespace context.
StringgetPrefix(String uri)
Returns the prefix associated with the given namespace URI.
ObjectgetProperty(String name)
Returns the implementation-specific feature or property of the given name.
voidsetDefaultNamespace(String uri)
Sets the URI for the default namespace.
voidsetNamespaceContext(NamespaceContext context)
Sets the namespace context for namespace resolution.
voidsetPrefix(String prefix, String uri)
Sets the prefix for the given namespace URI.
voidwriteAttribute(String localName, String value)
Write an attribute.
voidwriteAttribute(String prefix, String namespaceURI, String localName, String value)
Write an attribute.
voidwriteAttribute(String namespaceURI, String localName, String value)
Write an attribute.
voidwriteCData(String data)
Write a CDATA section.
voidwriteCharacters(String text)
Write the specified text.
voidwriteCharacters(char[] text, int start, int len)
Write the specified text.
voidwriteComment(String data)
Write a comment.
voidwriteDefaultNamespace(String namespaceURI)
Write a default namespace declaration.
voidwriteDTD(String dtd)
Write a DOCTYPE declaration.
voidwriteEmptyElement(String namespaceURI, String localName)
Write an empty tag.
voidwriteEmptyElement(String prefix, String localName, String namespaceURI)
Write an empty tag.
voidwriteEmptyElement(String localName)
Write an empty tag.
voidwriteEndDocument()
Closes any currently open tags.
voidwriteEndElement()
Closes the currently open tag.
voidwriteEntityRef(String name)
Write an entity reference.
voidwriteNamespace(String prefix, String namespaceURI)
Write a namespace declaration.
voidwriteProcessingInstruction(String target)
Write a processing instruction.
voidwriteProcessingInstruction(String target, String data)
Write a processing instruction.
voidwriteStartDocument()
Write an XML declaration.
voidwriteStartDocument(String version)
Write an XML declaration with the specified XML version.
voidwriteStartDocument(String encoding, String version)
Write an XML declaration with the specifed XML version and encoding.
voidwriteStartElement(String localName)
Write the start of a tag.
voidwriteStartElement(String namespaceURI, String localName)
Write the start of a tag.
voidwriteStartElement(String prefix, String localName, String namespaceURI)
Write the start of a tag.

Method Detail

close

public void close()
Frees any resources used by this writer. This will not close the underlying output sink.

flush

public void flush()
Flushes any cached information to the underlying output sink.

getNamespaceContext

public NamespaceContext getNamespaceContext()
Returns the current namespace context.

getPrefix

public String getPrefix(String uri)
Returns the prefix associated with the given namespace URI.

getProperty

public Object getProperty(String name)
Returns the implementation-specific feature or property of the given name.

Throws: IllegalArgumentException if the property is not supported

setDefaultNamespace

public void setDefaultNamespace(String uri)
Sets the URI for the default namespace.

setNamespaceContext

public void setNamespaceContext(NamespaceContext context)
Sets the namespace context for namespace resolution.

setPrefix

public void setPrefix(String prefix, String uri)
Sets the prefix for the given namespace URI.

writeAttribute

public void writeAttribute(String localName, String value)
Write an attribute.

writeAttribute

public void writeAttribute(String prefix, String namespaceURI, String localName, String value)
Write an attribute.

writeAttribute

public void writeAttribute(String namespaceURI, String localName, String value)
Write an attribute.

writeCData

public void writeCData(String data)
Write a CDATA section.

writeCharacters

public void writeCharacters(String text)
Write the specified text.

writeCharacters

public void writeCharacters(char[] text, int start, int len)
Write the specified text.

writeComment

public void writeComment(String data)
Write a comment.

writeDefaultNamespace

public void writeDefaultNamespace(String namespaceURI)
Write a default namespace declaration.

writeDTD

public void writeDTD(String dtd)
Write a DOCTYPE declaration.

writeEmptyElement

public void writeEmptyElement(String namespaceURI, String localName)
Write an empty tag.

writeEmptyElement

public void writeEmptyElement(String prefix, String localName, String namespaceURI)
Write an empty tag.

writeEmptyElement

public void writeEmptyElement(String localName)
Write an empty tag.

writeEndDocument

public void writeEndDocument()
Closes any currently open tags.

writeEndElement

public void writeEndElement()
Closes the currently open tag.

writeEntityRef

public void writeEntityRef(String name)
Write an entity reference.

writeNamespace

public void writeNamespace(String prefix, String namespaceURI)
Write a namespace declaration.

writeProcessingInstruction

public void writeProcessingInstruction(String target)
Write a processing instruction.

writeProcessingInstruction

public void writeProcessingInstruction(String target, String data)
Write a processing instruction.

writeStartDocument

public void writeStartDocument()
Write an XML declaration.

writeStartDocument

public void writeStartDocument(String version)
Write an XML declaration with the specified XML version.

writeStartDocument

public void writeStartDocument(String encoding, String version)
Write an XML declaration with the specifed XML version and encoding.

writeStartElement

public void writeStartElement(String localName)
Write the start of a tag.

writeStartElement

public void writeStartElement(String namespaceURI, String localName)
Write the start of a tag.

writeStartElement

public void writeStartElement(String prefix, String localName, String namespaceURI)
Write the start of a tag.