org.plasma.sdo.xml
Class StreamMarshaller

java.lang.Object
  extended by org.plasma.sdo.xml.XMLProcessor
      extended by org.plasma.sdo.xml.Marshaller
          extended by org.plasma.sdo.xml.StreamMarshaller

public class StreamMarshaller
extends Marshaller

A Streaming API for XML (StAX) based XML marshaler which converts/writes an SDO data graph to various supplied (stream-based) XML output sources. As the data graph is traversed to generate output, containment and non containment reference (property) associations are detected and handled such that even though multiple references to the same data object are encountered, (where possible) no duplicate XML data is written to the result. This not only reduces the size of the XML result, but provides enough information related to containment and non containment references such that the original data graph can be coalesced and re-constituted from the XML back into a fully operational state. Of primary concern with regard to handling containment and non containment references is of course that the XML result be valid in relation to the associated XML Schema. XML Schema Instance (XSI) mechanisms are used to accommodate multiple XML representations of the same (SDO) Type under both containment and non containment scenarios.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.plasma.sdo.xml.Marshaller
Marshaller.PathNode
 
Field Summary
 
Fields inherited from class org.plasma.sdo.xml.Marshaller
document, flavor
 
Constructor Summary
StreamMarshaller(XMLDocument document)
          Constructor.
StreamMarshaller(XMLDocument document, XMLOptions options)
          Constructor.
 
Method Summary
protected  java.lang.String fromObject(Type sourceType, java.lang.Object value)
           
 void marshal(java.io.OutputStream stream)
           
 void marshal(javax.xml.transform.Result outputResult)
           
 void marshal(java.io.Writer outputWriter)
           
 
Methods inherited from class org.plasma.sdo.xml.XMLProcessor
getOptions, setOptions
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StreamMarshaller

public StreamMarshaller(XMLDocument document)
Constructor.

Parameters:
document - the document containing the root data object and other XML related values
options - the XML marshaling options
See Also:
XMLDocument

StreamMarshaller

public StreamMarshaller(XMLDocument document,
                        XMLOptions options)
Constructor.

Parameters:
document - the document containing the root data object and other XML related values
options - the XML marshaling options
See Also:
XMLDocument, XMLOptions
Method Detail

marshal

public void marshal(java.io.OutputStream stream)
             throws javax.xml.stream.XMLStreamException,
                    MarshallerException
Throws:
javax.xml.stream.XMLStreamException
MarshallerException

marshal

public void marshal(java.io.Writer outputWriter)
             throws javax.xml.stream.XMLStreamException,
                    MarshallerException
Throws:
javax.xml.stream.XMLStreamException
MarshallerException

marshal

public void marshal(javax.xml.transform.Result outputResult)
             throws javax.xml.stream.XMLStreamException,
                    MarshallerException
Throws:
javax.xml.stream.XMLStreamException
MarshallerException

fromObject

protected java.lang.String fromObject(Type sourceType,
                                      java.lang.Object value)
Overrides:
fromObject in class Marshaller


Copyright © 2013. All Rights Reserved.