close()
:
void
Close this writer and free any resources associated with the writer.
flush()
:
void
Write any cached data to the underlying output mechanism.
writeEndDocument()
:
void
Closes any start tags and writes corresponding end tags.
writeEndElement()
:
void
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.
writeRaw(raw
:
String)
:
void
Writes the given string directly into the output stream.
close
close()
:
void
Close this writer and free any resources associated with the
writer. This method does not close the underlying writer.
flush
flush()
:
void
Write any cached data to the underlying output mechanism.
getDefaultNamespace
getDefaultNamespace()
:
String
Returns the current default name space.
Returns:
the current default name space.
getPrefix
Gets the prefix the URI is bound to.
Parameters:
uri
-
the URI to use.
Returns:
the prefix or null.
setDefaultNamespace
setDefaultNamespace(uri
:
String)
:
void
Binds a URI to the default namespace.
This URI is bound
in the scope of the current START_ELEMENT / END_ELEMENT pair.
If this method is called before a START_ELEMENT has been written
the uri is bound in the root scope.
Parameters:
uri
-
the uri to bind to the default namespace, may be null.
setPrefix
Sets the prefix the uri is bound to. This prefix is bound
in the scope of the current START_ELEMENT / END_ELEMENT pair.
If this method is called before a START_ELEMENT has been written
the prefix is bound in the root scope.
Parameters:
prefix
-
the prefix to bind to the uri, may not be null.
uri
-
the uri to bind to the prefix, may be null.
writeAttribute
Writes an attribute to the output stream without
a prefix.
Parameters:
localName
-
the local name of the attribute.
value
-
the value of the attribute.
writeAttribute
Writes an attribute to the output stream.
Parameters:
prefix
-
the prefix for this attribute.
namespaceURI
-
the uri of the prefix for this attribute.
localName
-
the local name of the attribute.
value
-
the value of the attribute.
writeAttribute
Writes an attribute to the output stream.
Parameters:
namespaceURI
-
the uri of the prefix for this attribute.
localName
-
the local name of the attribute.
value
-
the value of the attribute.
writeCData
writeCData(data
:
String)
:
void
Writes a CData section.
Parameters:
data
-
the data contained in the CData Section, may not be null.
writeCharacters
writeCharacters(text
:
String)
:
void
Write text to the output.
Parameters:
text
-
the value to write.
writeComment
writeComment(data
:
String)
:
void
Writes an XML comment with the data enclosed.
Parameters:
data
-
the data contained in the comment, may be null.
writeDefaultNamespace
writeDefaultNamespace(namespaceURI
:
String)
:
void
Writes the default namespace to the stream.
Parameters:
namespaceURI
-
the uri to bind the default namespace to.
writeDTD
Write a DTD section. This string represents the entire doctypedecl production
from the XML 1.0 specification.
Parameters:
dtd
-
the DTD to be written.
writeEmptyElement
writeEmptyElement(namespaceURI
:
String, localName
:
String)
:
void
Writes an empty element tag to the output.
Parameters:
namespaceURI
-
the uri to bind the tag to, may not be null.
localName
-
local name of the tag, may not be null.
writeEmptyElement
Writes an empty element tag to the output.
Parameters:
prefix
-
the prefix of the tag, may not be null.
localName
-
local name of the tag, may not be null.
namespaceURI
-
the uri to bind the tag to, may not be null.
writeEmptyElement
writeEmptyElement(localName
:
String)
:
void
Writes an empty element tag to the output.
Parameters:
localName
-
local name of the tag, may not be null.
writeEndDocument
writeEndDocument()
:
void
Closes any start tags and writes corresponding end tags.
writeEndElement
writeEndElement()
:
void
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.
writeEntityRef
writeEntityRef(name
:
String)
:
void
Writes an entity reference.
Parameters:
name
-
the name of the entity.
writeNamespace
writeNamespace(prefix
:
String, namespaceURI
:
String)
:
void
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.
Parameters:
prefix
-
the prefix to bind this namespace to.
namespaceURI
-
the uri to bind the prefix to.
writeProcessingInstruction
writeProcessingInstruction(target
:
String)
:
void
Writes a processing instruction.
Parameters:
target
-
the target of the processing instruction, may not be null.
writeProcessingInstruction
writeProcessingInstruction(target
:
String, data
:
String)
:
void
Writes a processing instruction.
Parameters:
target
-
the target of the processing instruction, may not be null.
data
-
the data contained in the processing instruction, may not be null.
writeRaw
Writes the given string directly into the output stream. No checks
regarding the correctness of the XML are done. The caller must ensure
that the final result is a correct XML.
Parameters:
raw
-
the string to write to the output stream.
writeStartDocument
writeStartDocument()
:
void
Write the XML Declaration. Defaults the XML version to 1.0, and the encoding to utf-8
writeStartDocument
writeStartDocument(version
:
String)
:
void
Write the XML Declaration. Defaults the XML version to 1.0
Parameters:
version
-
version of the xml document.
writeStartDocument
writeStartDocument(encoding
:
String, version
:
String)
:
void
Write the XML Declaration. Note that the encoding parameter does
not set the actual encoding of the underlying output. That must
be set when the instance of the XMLStreamWriter is created using the
XMLOutputFactory.
Parameters:
encoding
-
encoding of the xml declaration.
version
-
version of the xml document.
writeStartElement
writeStartElement(localName
:
String)
:
void
Writes a start tag to the output. All writeStartElement methods
open a new scope in the internal namespace context. Writing the
corresponding EndElement causes the scope to be closed.
Parameters:
localName
-
local name of the tag, may not be null.
writeStartElement
writeStartElement(namespaceURI
:
String, localName
:
String)
:
void
Writes a start tag to the output.
Parameters:
namespaceURI
-
the namespaceURI of the prefix to use, may not be null.
localName
-
local name of the tag, may not be null.
writeStartElement
Writes a start tag to the output.
Parameters:
prefix
-
the prefix of the tag, may not be null.
localName
-
local name of the tag, may not be null.
namespaceURI
-
the uri to bind the prefix to, may not be null.