SMILA (incubation) API documentation

org.eclipse.smila.datamodel.xml
Class StaxRecordWriter

java.lang.Object
  extended by org.eclipse.smila.datamodel.xml.StaxRecordWriter

public class StaxRecordWriter
extends java.lang.Object

StAX based Id writer. Should give better performance than the DOM based IdBuilder.

Author:
jschumacher

Constructor Summary
StaxRecordWriter()
          create default instance.
StaxRecordWriter(boolean printPretty)
           
 
Method Summary
protected static java.lang.String cleanText(java.lang.String text)
           
 void writeRecord(javax.xml.stream.XMLStreamWriter staxWriter, Record record)
          Append a rec:Record element describing the given record to the given XML stream.
 void writeRecordList(javax.xml.stream.XMLStreamWriter staxWriter, java.lang.Iterable<Record> records)
          Append a rec:RecordList element describing the given record list to the given XML stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StaxRecordWriter

public StaxRecordWriter()
create default instance.


StaxRecordWriter

public StaxRecordWriter(boolean printPretty)
Parameters:
printPretty - set to true to add newlines after each element tag.
Method Detail

writeRecord

public void writeRecord(javax.xml.stream.XMLStreamWriter staxWriter,
                        Record record)
                 throws javax.xml.stream.XMLStreamException
Append a rec:Record element describing the given record to the given XML stream. The element contains a namespace declaration for xmlns:rec.

Parameters:
staxWriter - target XML stream
record - the record to write
Throws:
javax.xml.stream.XMLStreamException - StAX error

writeRecordList

public void writeRecordList(javax.xml.stream.XMLStreamWriter staxWriter,
                            java.lang.Iterable<Record> records)
                     throws javax.xml.stream.XMLStreamException
Append a rec:RecordList element describing the given record list to the given XML stream. The element contains a namespace declaration for xmlns:rec.

Parameters:
staxWriter - target XML stream
records - the record list to transform.
Throws:
javax.xml.stream.XMLStreamException - StAX error

cleanText

protected static java.lang.String cleanText(java.lang.String text)
Parameters:
text - input text (XML)
Returns:
XML text cleaned from characters forbidden in XML 1.1 specification

SMILA (incubation) API documentation