You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by Eran Chinthaka <ch...@opensource.lk> on 2004/12/02 07:14:30 UTC
[Axis2] OM and Databinding
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