axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Eran Chinthaka" <chinth...@opensource.lk>
Subject [Axis2] OM and Databinding
Date Thu, 02 Dec 2004 06:14:30 GMT
Hi,

 

This is what I propose how we can use databinding with OM.

 

Most of the existing databinding tools can support StAX events (by
converting to SAX - Push events) for marshalling and unmarshalling. 

 

This is how one can generate StAX events from an OMElement.

 

OMXMLParserWrapper parserWrapper = new OMStAXBuilder(staxParser);

      StreamingWrapper wrapper = new OMStAXWrapper(parserWrapper,
startNode);

      wrapper.next();

 

This wrapper implements the javax.xml.stream.XMLStreamReader interface, so
that one can generate StAX events to do his tasks. So a databinding tool
like Castor, JAXB or whatever will use this api to unmarshall from OM.

 

 

For building OM from generated classes from a data binding tool; 

 

            OM expects any object which OM can register
org.xml.sax.ContentHandler with that. 

 

OutObject outObject = new OutObject();

outObject.setContentHandler(omContentHandler);  

outObject.startBuilding();

 

 

the omContentHandler will build the OM depending on the events it receives.
And OM will defer this building until it receives a request to the contents
of the objects. When OM receives the request only, it starts building.  This
is same as the deferred building we did in IN path also. 

 

 

I think IMO, this will help to keep OM independent of the databinding stuff,
except exposing StAX and push interfaces. 

 

 

 

  _____  

Eran Chinthaka

Lanka Software Foundation

 


Mime
View raw message