org.apache.axiom.om
Interface OMDataSource

All Known Subinterfaces:
OMDataSourceExt, QNameAwareOMDataSource
All Known Implementing Classes:
AbstractOMDataSource, AbstractPullOMDataSource, AbstractPushOMDataSource, ByteArrayDataSource, CharArrayDataSource, InputStreamDataSource, JAXBOMDataSource, OMDataSourceExtBase, ParserInputStreamDataSource, PushOMDataSource, WrappedTextNodeOMDataSource, WrappedTextNodeOMDataSourceFromDataSource, WrappedTextNodeOMDataSourceFromReader

public interface OMDataSource

Interface to arbitrary source of XML element data. This provides the hook for using a general data source (such as data binding frameworks) as the backing source of data for an element.


Method Summary
 XMLStreamReader getReader()
          Get parser for element data.
 void serialize(OutputStream output, OMOutputFormat format)
          Serializes element data directly to stream.
 void serialize(Writer writer, OMOutputFormat format)
          Serializes element data directly to writer.
 void serialize(XMLStreamWriter xmlWriter)
          Serializes element data directly to StAX writer.
 

Method Detail

serialize

void serialize(OutputStream output,
               OMOutputFormat format)
               throws XMLStreamException
Serializes element data directly to stream.

It is assumed that this method consumes the content (i.e. destroys the backing object) unless the data source also implements OMDataSourceExt and OMDataSourceExt.isDestructiveWrite() returns false.

Parameters:
output - destination stream for element XML text
format - Output format information. The implementation must use this information to choose the correct character set encoding when writing to the output stream. This parameter must not be null.
Throws:
XMLStreamException

serialize

void serialize(Writer writer,
               OMOutputFormat format)
               throws XMLStreamException
Serializes element data directly to writer.

It is assumed that this method consumes the content (i.e. destroys the backing object) unless the data source also implements OMDataSourceExt and OMDataSourceExt.isDestructiveWrite() returns false.

Parameters:
writer - destination writer for element XML text
format - output format information (null if none; may be ignored if not supported by data binding even if supplied)
Throws:
XMLStreamException

serialize

void serialize(XMLStreamWriter xmlWriter)
               throws XMLStreamException
Serializes element data directly to StAX writer.

The implementation of this method must satisfy the following requirements:

On the other hand, the caller of this method (typically an OMSourcedElement instance) must ensure that the following requirements are satisfied:

It is assumed that this method consumes the content (i.e. destroys the backing object) unless the data source also implements OMDataSourceExt and OMDataSourceExt.isDestructiveWrite() returns false.

Parameters:
xmlWriter - destination writer
Throws:
XMLStreamException

getReader

XMLStreamReader getReader()
                          throws XMLStreamException
Get parser for element data. In the general case this may require the data source to serialize data as XML text and then parse that text.

It is assumed that this method consumed the content (i.e. destroys the backing object) unless the data source also implements OMDataSourceExt and OMDataSourceExt.isDestructiveRead() returns false.

Returns:
element parser
Throws:
XMLStreamException


Copyright © 2004-2012 The Apache Software Foundation. All Rights Reserved.