|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface XMLWriter
XML writer implementations don't need to be thread safe.
Method Summary | |
---|---|
void |
close()
Closes this XML writer. |
void |
endAllElements()
Closes all open elements and flushes buffered data to output. |
void |
endElement()
Closes the current element. |
void |
setOutput(java.io.Writer output,
boolean close)
Sets the output destination for this XML writer. |
void |
writeCharData(java.lang.String text,
boolean isCDATASection)
Writes character data to the current position in a document. |
void |
writeComment(java.lang.String comment)
Writes a comment to the current position in a document. |
void |
writeDeclaration(boolean standalone,
java.lang.String encoding)
Writes the XML declaration, specifying standalone document declaration and encoding declaration. |
void |
writeElement(java.lang.String name,
java.util.List att,
java.lang.String text)
Writes a new element to the current position in a document. |
void |
writeEmptyElement(java.lang.String name,
java.util.List att)
Writes an empty element tag to the current position in a document. |
Method Detail |
---|
void close() throws KNXMLException
If this XML writer is already closed, no action is performed. All open elements are
closed. If for an output source was specified to get closed on invocation of this
method, it is closed (calling Writer.close()
before return.
KNXMLException
endAllElements()
void endAllElements() throws KNXMLException
KNXMLException
- on output errorvoid endElement() throws KNXMLException
KNXMLException
- on output errorvoid setOutput(java.io.Writer output, boolean close)
If this XML writer was already closed, setting a new output has no effect.
output
- a writer for outputclose
- true
if the specified writer should be closed on
close()
, false
to leave it openvoid writeCharData(java.lang.String text, boolean isCDATASection) throws KNXMLException
Character data can be put into CDATA sections.
CDATA sections begin with the string "<![CDATA[" and end with the string
"]]>". A CDATA section is used to escape text with characters which would be
recognized as markup otherwise.
Predefined entities in text
are replaced before write, iff the
character data to write is no CDATA section. Data in CDATA sections is not
modified.
text
- text to write, the character dataisCDATASection
- true
to write data into CDATA section,
false
to write default character data
KNXMLException
- on output errorvoid writeComment(java.lang.String comment) throws KNXMLException
The text of the comment is wrapped with "<!--" and "-->" by this method. The string "--" (double-hyphen) must not occur within comments.
comment
- text of the comment
KNXMLException
- on output errorvoid writeDeclaration(boolean standalone, java.lang.String encoding) throws KNXMLException
The version information is always 1.0
.
Note that an arbitrary encoding might be specified in the declaration. It is not
necessarily checked by the XML writer whether the actual output meets that
encoding. The user is responsible to specify the encoding matching the output
writer.
standalone
- true
if there are no external markup declarations,
false
to indicates that there are or may be such external
markup declarationsencoding
- character encoding (for example "UTF-8"), case-insensitive, (IANA
registered name)
KNXMLException
- on output errorvoid writeElement(java.lang.String name, java.util.List att, java.lang.String text) throws KNXMLException
Predefined entities in text
are replaced with references before
write.
name
- element name, the element's typeatt
- attribute specifications for this element, empty list or
null
for no attributestext
- text to write, the character data, null
for no data
KNXMLException
- on output errorvoid writeEmptyElement(java.lang.String name, java.util.List att) throws KNXMLException
Note that an empty element tag has no content and endElement()
does not
recognize such elements.
name
- element name, the element's typeatt
- attribute specifications for this element, empty list or
null
for no attributes
KNXMLException
- on output error
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |