|
Last update: 2011-06-23 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.proteios.io.XMLCrudeWriter3Impl
public class XMLCrudeWriter3Impl
This class supports crude XML writing, with some added convenience methods. This class 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. 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 indentation level starts at -1 instead of 0.
| Constructor Summary | |
|---|---|
XMLCrudeWriter3Impl(OutputStream outStream)
Constructor that takes an output stream as parameter. |
|
| Method Summary | |
|---|---|
void |
close()
Close (not) output stream. |
void |
flush()
Flushes output stream. |
int |
getByteBufferSize()
Get size of byte buffer for writing a String to an OutputStream. |
int |
getIndentationLevel()
Get indentation level. |
OutputStream |
getOutStream()
Get output stream. |
boolean |
isIndentationUsed()
Get indentation use flag. |
void |
setByteBufferSize(int byteBufferSize)
Set size of byte buffer for writing a String to an OutputStream. |
void |
setIndentationLevel(int level)
Set indentation level. |
void |
setIndentationUsed(boolean indentationUsed)
Set indentation use flag. |
void |
setOutStream(OutputStream outStream)
Set 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 |
writeEndTag(String element)
Writes XML end tag for XML block. |
void |
writeIndentedText(String text,
int extraIndentation)
Writes indented text with optional extra indentation. |
void |
writeNamespace(String name,
String value)
Writes XML namespace. |
void |
writeSimpleElementPair(String elementName,
String data)
Convenience method for writing simple element pair. |
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. |
void |
writeStartListTag(String element,
int count)
Writes XML start list tag for XML block. |
void |
writeStartTag(String element)
Writes XML start tag for XML block. |
void |
writeStyleSheetHeader(String type,
String href)
Writes XML style sheet header. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public XMLCrudeWriter3Impl(OutputStream outStream)
outStream - The FileWriter output stream to use.| Method Detail |
|---|
public OutputStream getOutStream()
getOutStream in interface XMLCrudeWriterpublic void setOutStream(OutputStream outStream)
setOutStream in interface XMLCrudeWriteroutStream - output stream to use.public boolean isIndentationUsed()
isIndentationUsed in interface XMLCrudeWriterpublic void setIndentationUsed(boolean indentationUsed)
setIndentationUsed in interface XMLCrudeWriterindentationUsed - boolean indentation use flag.public int getByteBufferSize()
public void setByteBufferSize(int byteBufferSize)
byteBufferSize - int byte buffer size for writing a string to an OutputStream.
public void writeStartDocument(String encoding,
String version)
throws javax.xml.stream.XMLStreamException
writeStartDocument in interface XMLCrudeWriterencoding - String with XML encoding.version - String with XML version.
javax.xml.stream.XMLStreamException - If there is an error
public void writeStyleSheetHeader(String type,
String href)
throws javax.xml.stream.XMLStreamException
type - String XML style sheet type, e.g. "text/xsl", .href - String Name of XSL file.
javax.xml.stream.XMLStreamException - If there is an error
public void writeEndDocument()
throws javax.xml.stream.XMLStreamException
writeEndDocument in interface XMLCrudeWriterjavax.xml.stream.XMLStreamException - If there is an error
public void writeComment(String comment)
throws javax.xml.stream.XMLStreamException
writeComment in interface XMLCrudeWritercomment - String with comment.
javax.xml.stream.XMLStreamException - If there is an error
public void writeStartElement(String element)
throws javax.xml.stream.XMLStreamException
writeStartElement in interface XMLCrudeWriterelement - String with element name.
javax.xml.stream.XMLStreamException - If there is an error
public void writeAttribute(String name,
String value)
throws javax.xml.stream.XMLStreamException
writeAttribute in interface XMLCrudeWritername - String with attribute name.value - String with attribute value.
javax.xml.stream.XMLStreamException - If there is an error
public void writeNamespace(String name,
String value)
throws javax.xml.stream.XMLStreamException
writeNamespace in interface XMLCrudeWritername - String with namespace name.value - String with namespace value.
javax.xml.stream.XMLStreamException - If there is an error
public void writeSingleElementEnd()
throws javax.xml.stream.XMLStreamException
writeSingleElementEnd in interface XMLCrudeWriterjavax.xml.stream.XMLStreamException - If there is an error
public void writeStartElementEnd()
throws javax.xml.stream.XMLStreamException
writeStartElementEnd in interface XMLCrudeWriterjavax.xml.stream.XMLStreamException - If there is an error
public void writeEndElement(String element)
throws javax.xml.stream.XMLStreamException
writeEndElement in interface XMLCrudeWriterelement - String with element name.
javax.xml.stream.XMLStreamException - If there is an error
public void writeCharacters(String text)
throws javax.xml.stream.XMLStreamException
writeCharacters in interface XMLCrudeWritertext - String with element text.
javax.xml.stream.XMLStreamException - If there is an error
public void flush()
throws javax.xml.stream.XMLStreamException
flush in interface XMLCrudeWriterjavax.xml.stream.XMLStreamException - If there is an error
public void close()
throws javax.xml.stream.XMLStreamException
close in interface XMLCrudeWriterjavax.xml.stream.XMLStreamException - If there is an error
public void writeStartTag(String element)
throws javax.xml.stream.XMLStreamException
writeStartTag in interface XMLCrudeWriter2element - String with element name.
javax.xml.stream.XMLStreamException - If there is an XML Stream related error
public void writeStartListTag(String element,
int count)
throws javax.xml.stream.XMLStreamException
writeStartListTag in interface XMLCrudeWriter2element - String with element name.count - int the number of XML blocks in the list.
javax.xml.stream.XMLStreamException - If there is an XML Stream related error
public void writeEndTag(String element)
throws javax.xml.stream.XMLStreamException
writeEndTag in interface XMLCrudeWriter2element - String with element name.
javax.xml.stream.XMLStreamException - If there is an XML Stream related error
public void writeSimpleElementPair(String elementName,
String data)
throws javax.xml.stream.XMLStreamException
writeSimpleElementPair in interface XMLCrudeWriter2elementName - String with element name.data - String with element data.
javax.xml.stream.XMLStreamException - If there is an XML Stream related error
public void writeIndentedText(String text,
int extraIndentation)
throws javax.xml.stream.XMLStreamException
writeIndentedText in interface XMLCrudeWriter3text - String with text.extraIndentation - int optional extra indentation.
javax.xml.stream.XMLStreamException - If there is an errorpublic int getIndentationLevel()
getIndentationLevel in interface XMLCrudeWriter3public void setIndentationLevel(int level)
setIndentationLevel in interface XMLCrudeWriter3level - int The indentation level to set.
|
Last update: 2011-06-23 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||