org.apache.tuscany.sdo.api
Interface XMLStreamHelper


public interface XMLStreamHelper

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


Field Summary
static java.lang.String OPTION_DEFAULT_ROOT_TYPE
          Default Type to load DataObject if the element is unqualified/local without xsi:type or the qualified/global element or xsi:type fail to resolve.
 
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.HelperContext getHelperContext()
           
 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.
 commonj.sdo.DataObject loadObject(javax.xml.stream.XMLStreamReader reader, java.util.Map options)
          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 save(commonj.sdo.helper.XMLDocument document, javax.xml.stream.XMLStreamWriter writer, java.util.Map options)
           
 void saveObject(commonj.sdo.DataObject sdo, javax.xml.stream.XMLStreamWriter writer)
          Save a DataObject to an XML stream.
 void saveObject(commonj.sdo.DataObject sdo, javax.xml.stream.XMLStreamWriter writer, java.util.Map options)
           
 

Field Detail

OPTION_DEFAULT_ROOT_TYPE

static final java.lang.String OPTION_DEFAULT_ROOT_TYPE
Default Type to load DataObject if the element is unqualified/local without xsi:type or the qualified/global element or xsi:type fail to resolve. Can be null.

See Also:
Constant Field Values
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

save

void save(commonj.sdo.helper.XMLDocument document,
          javax.xml.stream.XMLStreamWriter writer,
          java.util.Map options)
          throws javax.xml.stream.XMLStreamException
Throws:
javax.xml.stream.XMLStreamException

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

loadObject

commonj.sdo.DataObject loadObject(javax.xml.stream.XMLStreamReader reader,
                                  java.util.Map options)
                                  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
options - OPTION_DEFAULT_ROOT_TYPE; can be null or empty
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

saveObject

void saveObject(commonj.sdo.DataObject sdo,
                javax.xml.stream.XMLStreamWriter writer,
                java.util.Map options)
                throws javax.xml.stream.XMLStreamException
Throws:
javax.xml.stream.XMLStreamException

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

getHelperContext

commonj.sdo.helper.HelperContext getHelperContext()


Copyright © 2008 The Apache Software Foundation. All Rights Reserved.