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 Dennis Sosnoski <dm...@sosnoski.com> on 2005/08/19 08:34:17 UTC
[Axis2] Databinding API issues
I took a look at the XMLBeans data binding implementation for Axis2, and
have got some questions about this. For one thing, it looks like the
toOM() methods actually build the OM representation of the databound
objects, while I thought the idea behind Axis2 was to keep the OM
virtual unless absolutely necessary (for something like signing).
Also, the way in which Axis gets the data out of the databound objects
is by using an XMLStreamReader. AFAIK, XMLBeans is the only framework
which directly supports using a reader to get the XML representation of
the objects. Most frameworks (including JiBX and JAXB 2.0) only support
push-style output, where you tell the framework to serialize the XML
representation to some form of output interface and it does so before
returning. We could write an adapter to basically store the output from
one of these frameworks and make it readable using an XMLStreamReader,
but it would probably have a substantial impact on performance.
For other data binding frameworks it's probably best to define a special
type of OMElement to hold on to the object and the corresponding
serializer until the serialize() method of the OMElement is called, then
serialize directly to the supplied target. If we need to instead create
a full OM representation, we can use a builder that implements the
XMLStreamWriter interface and supply this to the binding framework as
the target for the marshalling output. This does make for an
all-or-nothing expansion, but this is probably the best we can do with
most data binding frameworks.
There's also the issue of how to link data binding to the MTOM support,
so that a data binding framework can pass off components to be
marshalled as attachments (and likewise access attachments for
unmarshalling). I don't know if XMLBeans has any support for this yet,
but JAXB 2.0 has it and I'll be adding it into JiBX.
- Dennis
Re: [Axis2] Databinding API issues
Posted by robert burrell donkin <ro...@gmail.com>.
On 8/22/05, Dennis Sosnoski <dm...@sosnoski.com> wrote:
> Venkat Reddy wrote:
<snip>
> >- Lastly, Axis2 relies on data-binding during code-generation time,
> >and not during run-time. This means that the client programming model
> >is a bit restricted to using static stubs, rather than DII or dynamic
> >proxies.
> >
> >
> I don't really see this as a limitation. If you truly want to do dynamic
> web services I don't see any way you can effectively use data binding,
> since the whole point of data binding is converting to and from Java
> classes - if you don't know the XML structures in advance, there's no
> way to define the Java classes either.
this can be done using a dynamic binder and a list of candidate
classes. search the list of potential bindings and use the binding
that matches. not sure it'd be very useful, though. may have some
limited applicability in prototyping.
- robert
Re: [Axis2] Databinding API issues
Posted by Dennis Sosnoski <dm...@sosnoski.com>.
Venkat Reddy wrote:
>hi Dennis,
>
>Good to know you will focus on data-binding area. I and couple of guys
>here have explored JAXB 2.0 for writing an extension for Axis2, and
>saw a few issues:
>
>- as you mentioned already, JAXB doesn't provide a "pull-based" API to
>iterate over the XML types and generate java binding for each, like we
>do in XMLbeans.
>
>
This part doesn't look like too much of a problem, since it should be
easy to use an XMLStreamWriter interface instead. For the XMLBeans case,
I haven't looked but I imagine somebody has written a XMLStreamReader to
XMLStreamWriter copy method which can be used to effectively convert it
over to a compatible interface. That way the XMLBeans responses should
be able to stay virtual, rather than having to be converted over to OM
form before they're written.
>- The current design of Axis data-binding design requires a type
>mapper to be populated. This is easy while using XMLBeans, but turns
>out to be quite difficult with JAXB.
>
>
I was looking for an example of this, but didn't find anything yet. The
trivial EchoString example doesn't appear to use a type mapper. Is there
a better example for XMLBeans support around somewhere?
I'd think a type mapper is only required when you're implementing
wrapped support. For general doc/lit you should be able to turn the
entire body of the SOAP request over to the data binding framework and
have it return an object. Am I missing something here?
>- After running the binding compiler, there is no way to get a map or
>collection of all XML types and corresponding java types. It seems we
>need to write an vendor-specific plug-in for the JAXB binding compiler
>for retaining and storing such information for later use. This is the
>case with current Sun's JAXB RI.
>
>
I don't know that it'd be possible to provide wrapped support using
JAXB. I had to make a number of enhancements to JiBX to support this.
Here again, I'm assuming you mean this in the wrapped context.
>- Lastly, Axis2 relies on data-binding during code-generation time,
>and not during run-time. This means that the client programming model
>is a bit restricted to using static stubs, rather than DII or dynamic
>proxies.
>
>
I don't really see this as a limitation. If you truly want to do dynamic
web services I don't see any way you can effectively use data binding,
since the whole point of data binding is converting to and from Java
classes - if you don't know the XML structures in advance, there's no
way to define the Java classes either.
>just throwing some of my observations.
>
>
Thanks, let me know whether I'm misinterpreting things in my responses.
- Dennis
Re: [Axis2] Databinding API issues
Posted by Venkat Reddy <vr...@gmail.com>.
hi Dennis,
Good to know you will focus on data-binding area. I and couple of guys
here have explored JAXB 2.0 for writing an extension for Axis2, and
saw a few issues:
- as you mentioned already, JAXB doesn't provide a "pull-based" API to
iterate over the XML types and generate java binding for each, like we
do in XMLbeans.
- The current design of Axis data-binding design requires a type
mapper to be populated. This is easy while using XMLBeans, but turns
out to be quite difficult with JAXB.
- After running the binding compiler, there is no way to get a map or
collection of all XML types and corresponding java types. It seems we
need to write an vendor-specific plug-in for the JAXB binding compiler
for retaining and storing such information for later use. This is the
case with current Sun's JAXB RI.
- Lastly, Axis2 relies on data-binding during code-generation time,
and not during run-time. This means that the client programming model
is a bit restricted to using static stubs, rather than DII or dynamic
proxies.
just throwing some of my observations.
- venkat
On 8/22/05, Dennis Sosnoski <dm...@sosnoski.com> wrote:
> Hi Ajith,
>
> Glad to be part of the project!
>
> I understand the virtual nature of OM. I'd like to take advantage of
> that when writing the actual serialized output, so that the OM stays
> virtual when used for the output of a databinding operation. It looks
> like this should be very easy to implement, though - I assume you're
> using the OMNode.serialize() method for actually writing out the data,
> right? Then it should be just a matter of implementing a custom
> OMElement for each data binding framework, which knows how to serialize
> out a saved data object to an XMLStreamWriter when the serialize()
> method is called.
>
> Behind the scenes, we'd need to handle actually building an OM tree
> representation of the data from the object - but only if needed, since
> OM is virtual. This should give us the best possible performance.
>
> The code for this should be very similar between JiBX and JAXB 2.0, so I
> should be able to implement these both at the same time (the research
> license for JAXB 2.0 gives me some concern on this, but I'd expect that
> just implementing and distributing code that uses part of the API is
> valid under the terms of the license as long as the JAXB 2.0 API is not
> itself exposed or redistributed). I'll start in modifying the JiBX input
> and output to work with XMLStreamReader and XMLStreamWriter,
> respectively, in about a week from now when I get out the JiBX 1.0
> production release. The official support for these will be in a 1.1
> build of JiBX. Once I have the basic JiBX changes in place I'll work on
> hand-crafting DatabindingSupporter classes for JiBX and JAXB 2.0.
>
> - Dennis
>
> Ajith Ranabahu wrote:
>
> > Hello Dennis,
> > Glad to have you as an Axis committer and guess I should give you some
> > explanations to why there are toOM(...) and fromOM(...) methods. Seems
> > I'm a little late on answering but guess I should provide you an
> > explanation anyway :)
> > The Axis2 client API depends upon OM and expects and OMElement as the
> > input to a message being sent. Hence we must have the objects
> > converted to OM represntations and vice-versa. However building the OM
> > does not mean that the whole XML stream is parsed and converted into
> > the Object tree. It's OM and OM builds the Object model when
> > absolutely necessary :). Inside the databind supporteres what happens
> > is this conversion, where the pull stream is taken from the object and
> > fed into the builder(toOM) or the pullstream is taken from the
> > OMElement and fed into the XMLBeans factory to create the Object
> > (fromOM). The streaming API gives us the chance to get the events as
> > late as possible. (There are some problems we need to fix to have this
> > running smoothely with maximum performance. For starters attemting to
> > get the events without caching throws out an error with the XBeans
> > pull stream. Perhaps the object reference needs to be explicitly
> > maintained through out the process but seems I'll have to dig deep to
> > solve it. Until then the generated stubs have a 'element.build()'
> > statement). What I wanted to stress is that OM is virtual by it's
> > nature :)
> > You are absolutely right about the pull support in XMLBeans. AFAIK it
> > is the only known framework that has the capability of interefacing
> > through StAX. The best solution for doing it with other framworks I
> > guess is what Eran explained, a 'Push' builder. Push builders create
> > havoc in serialization (:)) but I guess we can make it work. To keep
> > the perf figures intact we actually made the builder hang on to the
> > object and push the events directly to the stream (through a content
> > handler) if needed. I'm not sure whether this code is still in the
> > code base but I remember well that we did something similar.
> > However the generated code is architectured in such a way that the
> > databind mechanism (may it be push,pull,XMLBeans, JiBX or JAXB) has
> > nothing to do with the stubs. The seperate databind supporter is the
> > one that handles the whole thing. Theoreticaly one can modify the
> > databind supporter and customize how objects are serialized. So If we
> > figure out how to do the serialization, putting it in shouldn't be a
> > problem.
> >
> > Dennis Sosnoski wrote:
> >
> >> I took a look at the XMLBeans data binding implementation for Axis2,
> >> and have got some questions about this. For one thing, it looks like
> >> the toOM() methods actually build the OM representation of the
> >> databound objects, while I thought the idea behind Axis2 was to keep
> >> the OM virtual unless absolutely necessary (for something like signing).
> >
> >
> >
> >>
> >> Also, the way in which Axis gets the data out of the databound
> >> objects is by using an XMLStreamReader. AFAIK, XMLBeans is the only
> >> framework which directly supports using a reader to get the XML
> >> representation of the objects. Most frameworks (including JiBX and
> >> JAXB 2.0) only support push-style output, where you tell the
> >> framework to serialize the XML representation to some form of output
> >> interface and it does so before returning. We could write an adapter
> >> to basically store the output from one of these frameworks and make
> >> it readable using an XMLStreamReader, but it would probably have a
> >> substantial impact on performance.
> >>
> >> For other data binding frameworks it's probably best to define a
> >> special type of OMElement to hold on to the object and the
> >> corresponding serializer until the serialize() method of the
> >> OMElement is called, then serialize directly to the supplied target.
> >> If we need to instead create a full OM representation, we can use a
> >> builder that implements the XMLStreamWriter interface and supply this
> >> to the binding framework as the target for the marshalling output.
> >> This does make for an all-or-nothing expansion, but this is probably
> >> the best we can do with most data binding frameworks.
> >>
> >> There's also the issue of how to link data binding to the MTOM
> >> support, so that a data binding framework can pass off components to
> >> be marshalled as attachments (and likewise access attachments for
> >> unmarshalling). I don't know if XMLBeans has any support for this
> >> yet, but JAXB 2.0 has it and I'll be adding it into JiBX.
> >>
> >> - Dennis
> >>
> >
> >
>
Re: [Axis2] Databinding API issues
Posted by Dennis Sosnoski <dm...@sosnoski.com>.
Dennis Sosnoski wrote:
> ...
> I understand the virtual nature of OM. I'd like to take advantage of
> that when writing the actual serialized output, so that the OM stays
> virtual when used for the output of a databinding operation. It looks
> like this should be very easy to implement, though - I assume you're
> using the OMNode.serialize() method for actually writing out the data,
> right? Then it should be just a matter of implementing a custom
> OMElement for each data binding framework, which knows how to
> serialize out a saved data object to an XMLStreamWriter when the
> serialize() method is called.
Actually, on thinking this over it shouldn't even require a custom
OMElement for each data binding framework. Instead, it only requires a
standard interface with a writeObject(XMLStreamWriter) method which each
DataBindingSupporter class can implement. Then a single OMBindingElement
subclass can be added to use this interface.
- Dennis
Re: [Axis2] Databinding API issues
Posted by Dennis Sosnoski <dm...@sosnoski.com>.
Hi Ajith,
Glad to be part of the project!
I understand the virtual nature of OM. I'd like to take advantage of
that when writing the actual serialized output, so that the OM stays
virtual when used for the output of a databinding operation. It looks
like this should be very easy to implement, though - I assume you're
using the OMNode.serialize() method for actually writing out the data,
right? Then it should be just a matter of implementing a custom
OMElement for each data binding framework, which knows how to serialize
out a saved data object to an XMLStreamWriter when the serialize()
method is called.
Behind the scenes, we'd need to handle actually building an OM tree
representation of the data from the object - but only if needed, since
OM is virtual. This should give us the best possible performance.
The code for this should be very similar between JiBX and JAXB 2.0, so I
should be able to implement these both at the same time (the research
license for JAXB 2.0 gives me some concern on this, but I'd expect that
just implementing and distributing code that uses part of the API is
valid under the terms of the license as long as the JAXB 2.0 API is not
itself exposed or redistributed). I'll start in modifying the JiBX input
and output to work with XMLStreamReader and XMLStreamWriter,
respectively, in about a week from now when I get out the JiBX 1.0
production release. The official support for these will be in a 1.1
build of JiBX. Once I have the basic JiBX changes in place I'll work on
hand-crafting DatabindingSupporter classes for JiBX and JAXB 2.0.
- Dennis
Ajith Ranabahu wrote:
> Hello Dennis,
> Glad to have you as an Axis committer and guess I should give you some
> explanations to why there are toOM(...) and fromOM(...) methods. Seems
> I'm a little late on answering but guess I should provide you an
> explanation anyway :)
> The Axis2 client API depends upon OM and expects and OMElement as the
> input to a message being sent. Hence we must have the objects
> converted to OM represntations and vice-versa. However building the OM
> does not mean that the whole XML stream is parsed and converted into
> the Object tree. It's OM and OM builds the Object model when
> absolutely necessary :). Inside the databind supporteres what happens
> is this conversion, where the pull stream is taken from the object and
> fed into the builder(toOM) or the pullstream is taken from the
> OMElement and fed into the XMLBeans factory to create the Object
> (fromOM). The streaming API gives us the chance to get the events as
> late as possible. (There are some problems we need to fix to have this
> running smoothely with maximum performance. For starters attemting to
> get the events without caching throws out an error with the XBeans
> pull stream. Perhaps the object reference needs to be explicitly
> maintained through out the process but seems I'll have to dig deep to
> solve it. Until then the generated stubs have a 'element.build()'
> statement). What I wanted to stress is that OM is virtual by it's
> nature :)
> You are absolutely right about the pull support in XMLBeans. AFAIK it
> is the only known framework that has the capability of interefacing
> through StAX. The best solution for doing it with other framworks I
> guess is what Eran explained, a 'Push' builder. Push builders create
> havoc in serialization (:)) but I guess we can make it work. To keep
> the perf figures intact we actually made the builder hang on to the
> object and push the events directly to the stream (through a content
> handler) if needed. I'm not sure whether this code is still in the
> code base but I remember well that we did something similar.
> However the generated code is architectured in such a way that the
> databind mechanism (may it be push,pull,XMLBeans, JiBX or JAXB) has
> nothing to do with the stubs. The seperate databind supporter is the
> one that handles the whole thing. Theoreticaly one can modify the
> databind supporter and customize how objects are serialized. So If we
> figure out how to do the serialization, putting it in shouldn't be a
> problem.
>
> Dennis Sosnoski wrote:
>
>> I took a look at the XMLBeans data binding implementation for Axis2,
>> and have got some questions about this. For one thing, it looks like
>> the toOM() methods actually build the OM representation of the
>> databound objects, while I thought the idea behind Axis2 was to keep
>> the OM virtual unless absolutely necessary (for something like signing).
>
>
>
>>
>> Also, the way in which Axis gets the data out of the databound
>> objects is by using an XMLStreamReader. AFAIK, XMLBeans is the only
>> framework which directly supports using a reader to get the XML
>> representation of the objects. Most frameworks (including JiBX and
>> JAXB 2.0) only support push-style output, where you tell the
>> framework to serialize the XML representation to some form of output
>> interface and it does so before returning. We could write an adapter
>> to basically store the output from one of these frameworks and make
>> it readable using an XMLStreamReader, but it would probably have a
>> substantial impact on performance.
>>
>> For other data binding frameworks it's probably best to define a
>> special type of OMElement to hold on to the object and the
>> corresponding serializer until the serialize() method of the
>> OMElement is called, then serialize directly to the supplied target.
>> If we need to instead create a full OM representation, we can use a
>> builder that implements the XMLStreamWriter interface and supply this
>> to the binding framework as the target for the marshalling output.
>> This does make for an all-or-nothing expansion, but this is probably
>> the best we can do with most data binding frameworks.
>>
>> There's also the issue of how to link data binding to the MTOM
>> support, so that a data binding framework can pass off components to
>> be marshalled as attachments (and likewise access attachments for
>> unmarshalling). I don't know if XMLBeans has any support for this
>> yet, but JAXB 2.0 has it and I'll be adding it into JiBX.
>>
>> - Dennis
>>
>
>
Re: [Axis2] Databinding API issues
Posted by Ajith Ranabahu <aj...@gmail.com>.
Hello Dennis,
Glad to have you as an Axis committer and guess I should give you some
explanations to why there are toOM(...) and fromOM(...) methods. Seems
I'm a little late on answering but guess I should provide you an
explanation anyway :)
The Axis2 client API depends upon OM and expects and OMElement as the
input to a message being sent. Hence we must have the objects converted
to OM represntations and vice-versa. However building the OM does not
mean that the whole XML stream is parsed and converted into the Object
tree. It's OM and OM builds the Object model when absolutely necessary
:). Inside the databind supporteres what happens is this conversion,
where the pull stream is taken from the object and fed into the
builder(toOM) or the pullstream is taken from the OMElement and fed into
the XMLBeans factory to create the Object (fromOM). The streaming API
gives us the chance to get the events as late as possible. (There are
some problems we need to fix to have this running smoothely with maximum
performance. For starters attemting to get the events without caching
throws out an error with the XBeans pull stream. Perhaps the object
reference needs to be explicitly maintained through out the process but
seems I'll have to dig deep to solve it. Until then the generated stubs
have a 'element.build()' statement). What I wanted to stress is that OM
is virtual by it's nature :)
You are absolutely right about the pull support in XMLBeans. AFAIK it is
the only known framework that has the capability of interefacing through
StAX. The best solution for doing it with other framworks I guess is
what Eran explained, a 'Push' builder. Push builders create havoc in
serialization (:)) but I guess we can make it work. To keep the perf
figures intact we actually made the builder hang on to the object and
push the events directly to the stream (through a content handler) if
needed. I'm not sure whether this code is still in the code base but I
remember well that we did something similar.
However the generated code is architectured in such a way that the
databind mechanism (may it be push,pull,XMLBeans, JiBX or JAXB) has
nothing to do with the stubs. The seperate databind supporter is the one
that handles the whole thing. Theoreticaly one can modify the databind
supporter and customize how objects are serialized. So If we figure out
how to do the serialization, putting it in shouldn't be a problem.
Dennis Sosnoski wrote:
> I took a look at the XMLBeans data binding implementation for Axis2,
> and have got some questions about this. For one thing, it looks like
> the toOM() methods actually build the OM representation of the
> databound objects, while I thought the idea behind Axis2 was to keep
> the OM virtual unless absolutely necessary (for something like signing).
>
> Also, the way in which Axis gets the data out of the databound objects
> is by using an XMLStreamReader. AFAIK, XMLBeans is the only framework
> which directly supports using a reader to get the XML representation
> of the objects. Most frameworks (including JiBX and JAXB 2.0) only
> support push-style output, where you tell the framework to serialize
> the XML representation to some form of output interface and it does so
> before returning. We could write an adapter to basically store the
> output from one of these frameworks and make it readable using an
> XMLStreamReader, but it would probably have a substantial impact on
> performance.
>
> For other data binding frameworks it's probably best to define a
> special type of OMElement to hold on to the object and the
> corresponding serializer until the serialize() method of the OMElement
> is called, then serialize directly to the supplied target. If we need
> to instead create a full OM representation, we can use a builder that
> implements the XMLStreamWriter interface and supply this to the
> binding framework as the target for the marshalling output. This does
> make for an all-or-nothing expansion, but this is probably the best we
> can do with most data binding frameworks.
>
> There's also the issue of how to link data binding to the MTOM
> support, so that a data binding framework can pass off components to
> be marshalled as attachments (and likewise access attachments for
> unmarshalling). I don't know if XMLBeans has any support for this yet,
> but JAXB 2.0 has it and I'll be adding it into JiBX.
>
> - Dennis
>
Re: [Axis2] Databinding API issues
Posted by Eran Chinthaka <ch...@gmail.com>.
Hi Dennis,
I didn't think we could do it in that way. Great if we can have it
and I'd love to have it. Please please go ahead ...
On 8/20/05, Dennis Sosnoski <dm...@sosnoski.com> wrote:
> Eran Chinthaka wrote:
>
> >...
> >
> >
> >>For other data binding frameworks it's probably best to define a special
> >>type of OMElement to hold on to the object and the corresponding
> >>serializer until the serialize() method of the OMElement is called, then
> >>serialize directly to the supplied target. If we need to instead create
> >>a full OM representation, we can use a builder that implements the
> >>XMLStreamWriter interface and supply this to the binding framework as
> >>the target for the marshalling output.
> >>
> >>
> >
> >Well, I don't think the providing of XMLStreamWriter interface would help
> >for data binding frameworks other than XMLBeans.
> >
> >
> Hi Eran,
>
> JAXB 2.0 supports marshalling to an XMLStreamWriter instance, and I'm
> intending to add an adapter to support this in JiBX, too. When I said
> that the frameworks are using push-style output, I only meant this in
> terms of the code structure. So they can easily *write* their marshalled
> XML to an XMLStreamWriter, they just can't easily support having their
> marshalled XML pulled out of them with an XMLStreamReader (as XMLBeans can).
>
> So the only thing needed is an OM builder that can be used as an
> XMLStreamWriter. This should be easy, so if nobody else has one
> available or wants to implement it I can add it in myself.
>
> - Dennis
>
>
--
--------------------------------------------------------
Eran Chinthaka
Re: [Axis2] Databinding API issues
Posted by Dennis Sosnoski <dm...@sosnoski.com>.
Eran Chinthaka wrote:
>...
>
>
>>For other data binding frameworks it's probably best to define a special
>>type of OMElement to hold on to the object and the corresponding
>>serializer until the serialize() method of the OMElement is called, then
>>serialize directly to the supplied target. If we need to instead create
>>a full OM representation, we can use a builder that implements the
>>XMLStreamWriter interface and supply this to the binding framework as
>>the target for the marshalling output.
>>
>>
>
>Well, I don't think the providing of XMLStreamWriter interface would help
>for data binding frameworks other than XMLBeans.
>
>
Hi Eran,
JAXB 2.0 supports marshalling to an XMLStreamWriter instance, and I'm
intending to add an adapter to support this in JiBX, too. When I said
that the frameworks are using push-style output, I only meant this in
terms of the code structure. So they can easily *write* their marshalled
XML to an XMLStreamWriter, they just can't easily support having their
marshalled XML pulled out of them with an XMLStreamReader (as XMLBeans can).
So the only thing needed is an OM builder that can be used as an
XMLStreamWriter. This should be easy, so if nobody else has one
available or wants to implement it I can add it in myself.
- Dennis
RE: [Axis2] Databinding API issues
Posted by Eran Chinthaka <ch...@opensource.lk>.
>
Hi Dennis and all,
I'd like to comments on only some points of your mail.
> I took a look at the XMLBeans data binding implementation for Axis2, and
> have got some questions about this. For one thing, it looks like the
> toOM() methods actually build the OM representation of the databound
> objects, while I thought the idea behind Axis2 was to keep the OM
> virtual unless absolutely necessary (for something like signing).
>
> Also, the way in which Axis gets the data out of the databound objects
> is by using an XMLStreamReader. AFAIK, XMLBeans is the only framework
> which directly supports using a reader to get the XML representation of
> the objects. Most frameworks (including JiBX and JAXB 2.0) only support
> push-style output, where you tell the framework to serialize the XML
> representation to some form of output interface and it does so before
> returning. We could write an adapter to basically store the output from
> one of these frameworks and make it readable using an XMLStreamReader,
> but it would probably have a substantial impact on performance.
Well once I wrote an ObjectToOMBuilder, which was a builder who can build
the OM tree using a ContentHandler. But this was removed from the code, as
it was not fully implemented.
Anyway, my idea to this is to have a builder which can build from the push
interface. We can register a content handler with the data binding framework
and this in turn will pass the events to the special builder. Some times
this builder may implement the ContendHandler interface and I don't wanna
talk about the impl details at this point.
So if we go back to initial idea of OM, OM should be able to read and write
both pull and push interfaces. So using the above method we can make OM read
from push. And Ajith wrote the serializer to serialize even to push
interface.
>
> For other data binding frameworks it's probably best to define a special
> type of OMElement to hold on to the object and the corresponding
> serializer until the serialize() method of the OMElement is called, then
> serialize directly to the supplied target. If we need to instead create
> a full OM representation, we can use a builder that implements the
> XMLStreamWriter interface and supply this to the binding framework as
> the target for the marshalling output.
Well, I don't think the providing of XMLStreamWriter interface would help
for data binding frameworks other than XMLBeans.
-- Chinthaka
> This does make for an
> all-or-nothing expansion, but this is probably the best we can do with
> most data binding frameworks.
>
> There's also the issue of how to link data binding to the MTOM support,
> so that a data binding framework can pass off components to be
> marshalled as attachments (and likewise access attachments for
> unmarshalling). I don't know if XMLBeans has any support for this yet,
> but JAXB 2.0 has it and I'll be adding it into JiBX.
>
> - Dennis