Hi Eran; Building the OM from the SAX events is a good thing to have, even though in that way differed parsing is possible.
That allows DOM -> SAX -> OM Our first experimantal databinding approch (in M1 testcases .. see org.apache.axis.databinding/encoding.*) we had this. There was a way to create a OMElement with a SAX event emiiter and SAX events are played only if that element is accessed. We did this to represents content of the SOAP response Body and if nobody accsessed the SOAP body the SAX events are used to write the SOAPBody Content to the stream. Thanks Srinath On 10/27/05, Eran Chinthaka <[EMAIL PROTECTED]> wrote: > > > Steve Loughran wrote: > > > > > On the subject of data binding, it would suit me nicely if you could > > easily build an OMElement graph from a DOM or SAX tree. > > What do you mean here ? Are you asking for a special OMElement which > wraps any data binding object, as Dennis explained. > > > Because that way I could map from Xom to OMElement without printing > > everything to a StringBuffer and parsing it again. > > BTW, you all agree that the only missing "feature" we should have in > Axis2, for it to be promoted for 1.0 status, is Axis2 own databinding > implementation. I think Ajith has almost completed XMLBeans integration. > > So lets have a broader discussion on this. > > One of the concerns raised in the last chat is the integration of data > bound object to OM. > > So as I see there are two ways; > > 1. Getting pull parser from the data bound object, irrespective of which > framework was used to data bound, and create an OMElement out of it and > hangs that to the OM tree. > > DataBoundObject dbObj = // get the data bound object > OMElement dbObjWrapper = new > StaxOMBuilder(dataBoundObject.getPullParser()).getDocumentElement(); > > // add this to body of wherever you want > body.addChild(dbObjWrapper); > > 2. Giving the data bound object an XSR (XMLStreamWriter) and ask him to > serialize himself > DataBoundObject dbObj = // get the data bound object > SpecialOMElement dbObjContainer = new SpecialOMElement(dbObj); > dbObjContainer.serialize(xmlStreamWriter); > > (are there other approaches ? if so please comment) > > I personally prefer the first approach as it seems cleaner for me. Its > the same thing we do to connect data in to OMElement. And it nicely and > elegantly fit in to the differed building approach. This approach is > almost implemented for ADB (Axis2 Data Binding). > > Well the problem in that approach is that (thanks to Dennis for > pointing), JAXB, JiXB do not have a way of getting a pull parser. But > they do have a way of doing the second method. > > So this is a summary to the discussions so far. Please please comment on > this and lets *implement* the better way of doing it. > > -- Chinthaka > > > > > -steve > > > > > >