|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecttuwien.auto.calimero.xml.def.DefaultXMLWriter
public class DefaultXMLWriter
Default XML writer implementation of the XMLWriter interface.
Does not add any feature not already documented in the implemented interface.
This writer is not thread safe.
Constructor Summary | |
---|---|
DefaultXMLWriter()
Creates a new XML writer. |
|
DefaultXMLWriter(java.io.Writer w,
boolean close)
Creates a new XML writer with output w . |
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 content)
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DefaultXMLWriter()
public DefaultXMLWriter(java.io.Writer w, boolean close)
w
.
The writer is buffered by this XML writer.
w
- the output Writer
close
- true
to close w
if XML writer is closed,
false
otherwiseXMLWriter.setOutput(Writer, boolean)
Method Detail |
---|
public void close() throws KNXMLException
XMLWriter
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.
close
in interface XMLWriter
KNXMLException
XMLWriter.endAllElements()
public void endAllElements() throws KNXMLException
XMLWriter
endAllElements
in interface XMLWriter
KNXMLException
- on output errorpublic void endElement() throws KNXMLException
XMLWriter
endElement
in interface XMLWriter
KNXMLException
- on output errorpublic void setOutput(java.io.Writer output, boolean close)
XMLWriter
If this XML writer was already closed, setting a new output has no effect.
setOutput
in interface XMLWriter
output
- a writer for outputclose
- true
if the specified writer should be closed on
XMLWriter.close()
, false
to leave it openpublic void writeCharData(java.lang.String text, boolean isCDATASection) throws KNXMLException
XMLWriter
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.
writeCharData
in interface XMLWriter
text
- text to write, the character dataisCDATASection
- true
to write data into CDATA section,
false
to write default character data
KNXMLException
- on output errorpublic void writeComment(java.lang.String comment) throws KNXMLException
XMLWriter
The text of the comment is wrapped with "<!--" and "-->" by this method. The string "--" (double-hyphen) must not occur within comments.
writeComment
in interface XMLWriter
comment
- text of the comment
KNXMLException
- on output errorpublic void writeDeclaration(boolean standalone, java.lang.String encoding) throws KNXMLException
XMLWriter
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.
writeDeclaration
in interface XMLWriter
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 errorpublic void writeElement(java.lang.String name, java.util.List att, java.lang.String content) throws KNXMLException
XMLWriter
Predefined entities in text
are replaced with references before
write.
writeElement
in interface XMLWriter
name
- element name, the element's typeatt
- attribute specifications for this element, empty list or
null
for no attributescontent
- text to write, the character data, null
for no data
KNXMLException
- on output errorpublic void writeEmptyElement(java.lang.String name, java.util.List att) throws KNXMLException
XMLWriter
Note that an empty element tag has no content and XMLWriter.endElement()
does not
recognize such elements.
writeEmptyElement
in interface XMLWriter
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 |