|
Last update: 2011-06-23 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface XMLCrudeWriter
This interface defines crude XML writing. This interface contains some methods that may help writing XML files. It was created as support for e.g. writing single tags with XMLStreamWriter could not be found. It is up to the implementations to decide on indentation, which may be ignored if desired, but if guidelines are requested, recommended use is as follows: To get consistent indentation and change to a new line, the following rules are used: 1. A start element or comment starts a new line. 2. An end element starts a new line, unless following data. 3. Indentation level is increased by one before start element. 4. Indentation level is decreased by one after end element. To avoid having the outermost element block indented, the indentaiion level starts at -1 instead of 0.
| Method Summary | |
|---|---|
void |
close()
Close (not) output stream. |
void |
flush()
Flushes output stream. |
OutputStream |
getOutStream()
Get FileWriter output stream. |
boolean |
isIndentationUsed()
Get indentation use flag. |
void |
setIndentationUsed(boolean indentationUsed)
Set indentation use flag. |
void |
setOutStream(OutputStream outStream)
Set FileWriter output stream. |
void |
writeAttribute(String name,
String value)
Writes XML attribute. |
void |
writeCharacters(String text)
Writes text between XML start and end tags. |
void |
writeComment(String comment)
Writes XML comment. |
void |
writeEndDocument()
Writes end of XML document. |
void |
writeEndElement(String element)
Writes XML end element. |
void |
writeNamespace(String name,
String value)
Writes XML namespace. |
void |
writeSingleElementEnd()
Writes XML single element end. |
void |
writeStartDocument(String encoding,
String version)
Writes XML file header. |
void |
writeStartElement(String element)
Writes XML start element. |
void |
writeStartElementEnd()
Writes XML start element end. |
| Method Detail |
|---|
OutputStream getOutStream()
void setOutStream(OutputStream outStream)
outStream - FileWriter output stream.boolean isIndentationUsed()
void setIndentationUsed(boolean indentationUsed)
indentationUsed - boolean indenation use flag.
void writeStartDocument(String encoding,
String version)
throws javax.xml.stream.XMLStreamException
encoding - String with XML encoding.version - String with XML version.
javax.xml.stream.XMLStreamException - If there is an error
void writeEndDocument()
throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException - If there is an error
void writeComment(String comment)
throws javax.xml.stream.XMLStreamException
comment - String with comment.
javax.xml.stream.XMLStreamException - If there is an error
void writeStartElement(String element)
throws javax.xml.stream.XMLStreamException
element - String with element name.
javax.xml.stream.XMLStreamException - If there is an error
void writeAttribute(String name,
String value)
throws javax.xml.stream.XMLStreamException
name - String with attribute name.value - String with attribute value.
javax.xml.stream.XMLStreamException - If there is an error
void writeNamespace(String name,
String value)
throws javax.xml.stream.XMLStreamException
name - String with namespace name.value - String with namespace value.
javax.xml.stream.XMLStreamException - If there is an error
void writeStartElementEnd()
throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException - If there is an error
void writeSingleElementEnd()
throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException - If there is an error
void writeEndElement(String element)
throws javax.xml.stream.XMLStreamException
element - String with element name.
javax.xml.stream.XMLStreamException - If there is an error
void writeCharacters(String text)
throws javax.xml.stream.XMLStreamException
text - String with element text.
javax.xml.stream.XMLStreamException - If there is an error
void flush()
throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException - If there is an error
void close()
throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException - If there is an error
|
Last update: 2011-06-23 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||