TypedXMLStream

Introduction

This is a proposal for a Streaming API that the AXIOM implementation can use. The java source files are available in the scratch area here:

http://svn.apache.org/repos/asf/webservices/axis/trunk/java/dev/scratch/priyanga_sanjiva/

Mainly it has two interfaces. They are

  1. TypedXMLStreamReader
  2. TypedXMLStreamWriter

TypedXMLStreamReader

This is the streaming API, to be used by AXIOM implementation. It extends from two interfaces. i.e.

  1. javax.xml.stream.XMLStreamReader (StAX)
  2. org.apache.axis.xml.ContentComparable – This interface provides methods to compare the local names, prefixes and the attribute values with given String objects, without creating unnecessary String objects.

And the TypedXMLStreamReader has some more methods to access the xml content as java typed values. (Without creating unnecessary, intermediary immutable String objects) i.e. You can retrieve a xsd typed value as the appropriate java typed value. (e.g. xsd:int -> java:int, xsd:Base64 -> java:byte[], etc.,)

The TypedXMLStreamReader API can be used by the Deserializer. See the diagram below.

http://nagoya.apache.org/~dims/axis2/OMDiagrams/deserialization.GIF

The OM Builder can use the javax.xml.stream.XMLStreamReader (standard StAX API) since it needs only Strings to create DOM like objects.

TypedXMLStreamWriter

This is the xml push API, to be used by AXIOM implementation. It extends from javax.xml.stream.XMLStreamWriter interface. Similar to the above case the TypedXMLStreamWriter also has a set of methods to serialize java typed values as their appropriate xsd counterparts. (Without creating unnecessary, intermediary immutable String objects)

This can be used as the Stream Writer. See the diagram below.

http://nagoya.apache.org/~dims/axis2/OMDiagrams/serialization.GIF

Implementation

We can implement a native implementation of the above interfaces and keep it as default. For that implementation we can use lxpp, which is an opensource implementation of lk.opensource.xml.parsers.TypedXMLPullParser and its components. (cvs.opensource.lk/lxpp)

And also we can write a general wrapper which can wrap any of the StAX implementation and provide the above API.