Last update: 2011-06-23

org.proteios.io
Interface XMLCrudeWriter2

All Superinterfaces:
XMLCrudeWriter
All Known Subinterfaces:
XMLCrudeWriter3
All Known Implementing Classes:
XMLCrudeWriter2Impl, XMLCrudeWriter3Impl

public interface XMLCrudeWriter2
extends XMLCrudeWriter

This interface defines crude XML writing, with some added convenience methods. 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.

Version:
2.0
Author:
Olle
Last modified
$Date: 2007-05-09 10:56:00 +0100 (Wed, 09 May 2007) $

Method Summary
 void writeEndTag(String element)
          Writes XML end tag for XML block.
 void writeSimpleElementPair(String elementName, String data)
          Convenience method for writing simple element pair.
 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.
 
Methods inherited from interface org.proteios.io.XMLCrudeWriter
close, flush, getOutStream, isIndentationUsed, setIndentationUsed, setOutStream, writeAttribute, writeCharacters, writeComment, writeEndDocument, writeEndElement, writeNamespace, writeSingleElementEnd, writeStartDocument, writeStartElement, writeStartElementEnd
 

Method Detail

writeStartTag

void writeStartTag(String element)
                   throws javax.xml.stream.XMLStreamException
Writes XML start tag for XML block.

Parameters:
element - String with element name.
Throws:
javax.xml.stream.XMLStreamException - If there is an XML Stream related error

writeStartListTag

void writeStartListTag(String element,
                       int count)
                       throws javax.xml.stream.XMLStreamException
Writes XML start list tag for XML block.

Parameters:
element - String with element name.
count - int the number of XML blocks in the list.
Throws:
javax.xml.stream.XMLStreamException - If there is an XML Stream related error

writeEndTag

void writeEndTag(String element)
                 throws javax.xml.stream.XMLStreamException
Writes XML end tag for XML block.

Parameters:
element - String with element name.
Throws:
javax.xml.stream.XMLStreamException - If there is an XML Stream related error

writeSimpleElementPair

void writeSimpleElementPair(String elementName,
                            String data)
                            throws javax.xml.stream.XMLStreamException
Convenience method for writing simple element pair. Writes XMl expression like: data

Parameters:
elementName - String with element name.
data - String with element data.
Throws:
javax.xml.stream.XMLStreamException - If there is an XML Stream related error

Last update: 2011-06-23