org.apache.tuscany.sdo.helper
Interface XMLStreamHelper

All Known Implementing Classes:
XMLStreamHelperImpl

public interface XMLStreamHelper

Helper interface for reading and writing SDO DataObjects from XML streams (StAX).


Method Summary
 javax.xml.stream.XMLStreamReader createXMLStreamReader(commonj.sdo.DataObject sdo)
          Creates and returns a XMLStreamReader that can be used to read a DataObject as a XML event stream.
 javax.xml.stream.XMLStreamReader createXMLStreamReader(commonj.sdo.helper.XMLDocument document)
          Creates and returns a XMLStreamReader that can be used to read an XMLDocument as a XML event stream.
 commonj.sdo.helper.XMLDocument load(javax.xml.stream.XMLStreamReader reader)
          Creates and returns an XMLDocument from an XML input stream.
 commonj.sdo.DataObject loadObject(javax.xml.stream.XMLStreamReader reader)
          Create a DataObject from an element in a XML stream.
 void save(commonj.sdo.helper.XMLDocument document, javax.xml.stream.XMLStreamWriter writer)
          Save a XMLDocument to an XML stream.
 void saveObject(commonj.sdo.DataObject sdo, javax.xml.stream.XMLStreamWriter writer)
          Save a DataObject to an XML stream.
 

Method Detail

load

commonj.sdo.helper.XMLDocument load(javax.xml.stream.XMLStreamReader reader)
                                    throws javax.xml.stream.XMLStreamException,
                                           java.lang.IllegalStateException
Creates and returns an XMLDocument from an XML input stream. The reader must be positioned on a START_DOCUMENT event.

Parameters:
reader - the stream to read
Returns:
an XMLDocument created from the stream
Throws:
javax.xml.stream.XMLStreamException - if there was a problem reading the stream
java.lang.IllegalStateException - if the reader is not positioned on a START_DOCUMENT event

save

void save(commonj.sdo.helper.XMLDocument document,
          javax.xml.stream.XMLStreamWriter writer)
          throws javax.xml.stream.XMLStreamException
Save a XMLDocument to an XML stream.

Parameters:
document - the document to be written
writer - the stream to write to
Throws:
javax.xml.stream.XMLStreamException - if there was a problem writing to the stream

createXMLStreamReader

javax.xml.stream.XMLStreamReader createXMLStreamReader(commonj.sdo.helper.XMLDocument document)
                                                       throws javax.xml.stream.XMLStreamException
Creates and returns a XMLStreamReader that can be used to read an XMLDocument as a XML event stream. The reader will be positioned on a START_DOCUMENT event.

Parameters:
document - the XMLDocument to be read
Returns:
an XMLStreamReader that can be used to read the document
Throws:
javax.xml.stream.XMLStreamException

loadObject

commonj.sdo.DataObject loadObject(javax.xml.stream.XMLStreamReader reader)
                                  throws javax.xml.stream.XMLStreamException,
                                         java.lang.IllegalStateException
Create a DataObject from an element in a XML stream. The reader must be positioned on a START_ELEMENT event.

Parameters:
reader - the stream to read
Returns:
a DataObject created from the element in the stream
Throws:
javax.xml.stream.XMLStreamException - if there was a problem reading the stream
java.lang.IllegalStateException - if the reader is not positioned on a START_ELEMENT event

saveObject

void saveObject(commonj.sdo.DataObject sdo,
                javax.xml.stream.XMLStreamWriter writer)
                throws javax.xml.stream.XMLStreamException
Save a DataObject to an XML stream.

Parameters:
sdo - the DataObject to be written
writer - the stream to write to
Throws:
javax.xml.stream.XMLStreamException - if there was a problem writing to the stream

createXMLStreamReader

javax.xml.stream.XMLStreamReader createXMLStreamReader(commonj.sdo.DataObject sdo)
Creates and returns a XMLStreamReader that can be used to read a DataObject as a XML event stream. The reader will be positioned on a START_ELEMENT event.

Parameters:
sdo - the DataObject to be read
Returns:
an XMLStreamReader that can be used to read the DataObject


Copyright © 2006 Apache Software Foundation. All Rights Reserved.