org.apache.tuscany.sdo.api
Interface XMLStreamHelper

All Known Subinterfaces:
XMLStreamHelper
All Known Implementing Classes:
XMLStreamHelperImpl

public interface XMLStreamHelper

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


Field Summary
static 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(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(XMLDocument document)
          Creates and returns a XMLStreamReader that can be used to read an XMLDocument as a XML event stream.
 HelperContext getHelperContext()
           
 XMLDocument load(javax.xml.stream.XMLStreamReader reader)
          Creates and returns an XMLDocument from an XML input stream.
 DataObject loadObject(javax.xml.stream.XMLStreamReader reader)
          Create a DataObject from an element in a XML stream.
 DataObject loadObject(javax.xml.stream.XMLStreamReader reader, Map options)
          Create a DataObject from an element in a XML stream.
 void save(XMLDocument document, javax.xml.stream.XMLStreamWriter writer)
          Save a XMLDocument to an XML stream.
 void save(XMLDocument document, javax.xml.stream.XMLStreamWriter writer, Map options)
           
 void saveObject(DataObject sdo, javax.xml.stream.XMLStreamWriter writer)
          Save a DataObject to an XML stream.
 void saveObject(DataObject sdo, javax.xml.stream.XMLStreamWriter writer, Map options)
           
 

Field Detail

OPTION_DEFAULT_ROOT_TYPE

static final 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

XMLDocument load(javax.xml.stream.XMLStreamReader reader)
                 throws javax.xml.stream.XMLStreamException,
                        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
IllegalStateException - if the reader is not positioned on a START_DOCUMENT event

save

void save(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(XMLDocument document,
          javax.xml.stream.XMLStreamWriter writer,
          Map options)
          throws javax.xml.stream.XMLStreamException
Throws:
javax.xml.stream.XMLStreamException

createXMLStreamReader

javax.xml.stream.XMLStreamReader createXMLStreamReader(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

DataObject loadObject(javax.xml.stream.XMLStreamReader reader)
                      throws javax.xml.stream.XMLStreamException,
                             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
IllegalStateException - if the reader is not positioned on a START_ELEMENT event

loadObject

DataObject loadObject(javax.xml.stream.XMLStreamReader reader,
                      Map options)
                      throws javax.xml.stream.XMLStreamException,
                             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
IllegalStateException - if the reader is not positioned on a START_ELEMENT event

saveObject

void saveObject(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(DataObject sdo,
                javax.xml.stream.XMLStreamWriter writer,
                Map options)
                throws javax.xml.stream.XMLStreamException
Throws:
javax.xml.stream.XMLStreamException

createXMLStreamReader

javax.xml.stream.XMLStreamReader createXMLStreamReader(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

HelperContext getHelperContext()


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