Eran Chinthaka wrote:
<snip>
So merging all the discussions, the argument biols down to who has the
control. So I can provide a method in ADBPullParser, so that you can do
some thing like this.
ADBPullParser adbPullParser = new ADBPullParser(qName, propertyList,
attributeList);
adbPullParser.serialize(xmlStreamWriter);
the implementation will be as follows.
if(object instanceof ADBBean){
// get a pull parser from adbBean and write that to the given xmlSR
}else if(object instanceof OMElement){
((OMElement)object).serialize(xmlSR)
}else if(object instanceof Bean){
// get a pull parser from the bean and serialize it to the xmlSR
}else {
// this should be one from other data binding tools. Give the xmlSR
to that object and ask him to serialize himself
}
I'm proposing this from the points taken from Eric and Dennis.
This definitely is a messy area, but I think the flexibility is
important if we want good performance from Axis2. The most efficient way
of doing things is probably always going to be writing the
representation directly to the xmlSW. Even copying from an xmlSR to an
xmlSW is generally going to be more overhead than writing directly to
the xmlSW (just because there's a layer of transformations in namespaces
and such), so you may find it's best to also use the xmlSW approach with
XMLBeans.
There are going to be cases where we need to build the OM representation
for all or part of the tree before serializing out the XML document, as
with WS-Security, and this is likely to have a substantial impact on
performance - but if you're doing WS-Security the overhead of building
the OM is the least of your performance concerns. As long as OM supports
building from either an xmlSR or an xmlSW this should be easy to
implement (and building from an xmlSW is easy, since this is very
similar to building from a SAX parser - in both cases the events are
delivered by calls to your handler methods).
- Dennis