You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tuscany.apache.org by Scott Kurz <sc...@gmail.com> on 2008/07/07 02:32:10 UTC

databinding-jaxb-axiom doesn't do an adjustElementName

I'm noticing a difference in the JAXB->Axiom serialization produced by the
new databinding-jaxb-axiom transform compared to the old transform
(JAXB2Node, Node2XMLStreamReader,XMLStreamReader2OMElement).

The difference is caused by the fact that the older transform (before
databinding-jaxb-axiom) had a call out to DOMHelper.adjustElementName() to,
like the method name suggests, adjust the element name to the one calculated
by tuscany-interfacedef processing, rather than relying only on JAXB APIs to
calculate the interface name.

Before I go into detail with my test app, (which I think I want to change
anyway), let me just ask this:  did we intend to make the same "adjustment"
with databinding-jaxb-axiom?

I'm not 100% sure of the reason for doing the adjustment in the older code,
so I just wanted to start with that question before bothering with my test
details.

Thanks,
Scott

Re: databinding-jaxb-axiom doesn't do an adjustElementName

Posted by Scott Kurz <sc...@gmail.com>.
Thanks for responding Raymond.

In my test the pkg-level JAXB annotations were left out of the app by
mistake, but I was surprised to find it worked with the old transform but
not the new......  which is why I put this post out there for others to
maybe learn from.

So that makes sense.  Unfortunately though, I don't have any good ideas on
how to deal with this and still benefit from the OMDataSource performance,
but at least mine was a corner case and not a top priority I would think.

Scott

On Mon, Jul 7, 2008 at 2:12 PM, Raymond Feng <en...@gmail.com> wrote:

>  Hi,
>
> For the XML data transformation, sometimes we don't care about the element.
> For example, if we pass a Customer from JAXB to SDO, we only care about the
> type (content) of the data. To be tolerating the case that both target and
> source sides expect the same type but different elements, we use
> "adjustElementName".
>
> Ideally for JAXB2OMElement, we should do the same trick. But we have an
> issue with JAXB as follows:
>
> Some JAXB classes are generated for global elements with @XmlRootElement
> annotation and the element QName is built into the JAXB metadata. The
> JAXB2OMElement uses the OMDataSource to lazily serialize JAXB data into XML
> stream. It would be difficult to adjust the element name at the stream level
> especially considering the performance penalty. Do you have any good ideas?
>
> Thanks,
> Raymond
>
>  *From:* Scott Kurz <sc...@gmail.com>
> *Sent:* Sunday, July 06, 2008 5:32 PM
> *To:* dev@tuscany.apache.org
> *Subject:* databinding-jaxb-axiom doesn't do an adjustElementName
>
> I'm noticing a difference in the JAXB->Axiom serialization produced by the
> new databinding-jaxb-axiom transform compared to the old transform
> (JAXB2Node, Node2XMLStreamReader,XMLStreamReader2OMElement).
>
> The difference is caused by the fact that the older transform (before
> databinding-jaxb-axiom) had a call out to DOMHelper.adjustElementName() to,
> like the method name suggests, adjust the element name to the one calculated
> by tuscany-interfacedef processing, rather than relying only on JAXB APIs to
> calculate the interface name.
>
> Before I go into detail with my test app, (which I think I want to change
> anyway), let me just ask this:  did we intend to make the same "adjustment"
> with databinding-jaxb-axiom?
>
> I'm not 100% sure of the reason for doing the adjustment in the older code,
> so I just wanted to start with that question before bothering with my test
> details.
>
> Thanks,
> Scott
>

Re: databinding-jaxb-axiom doesn't do an adjustElementName

Posted by Raymond Feng <en...@gmail.com>.
Hi,

For the XML data transformation, sometimes we don't care about the element. For example, if we pass a Customer from JAXB to SDO, we only care about the type (content) of the data. To be tolerating the case that both target and source sides expect the same type but different elements, we use "adjustElementName". 

Ideally for JAXB2OMElement, we should do the same trick. But we have an issue with JAXB as follows:

Some JAXB classes are generated for global elements with @XmlRootElement annotation and the element QName is built into the JAXB metadata. The JAXB2OMElement uses the OMDataSource to lazily serialize JAXB data into XML stream. It would be difficult to adjust the element name at the stream level especially considering the performance penalty. Do you have any good ideas?

Thanks,
Raymond


From: Scott Kurz 
Sent: Sunday, July 06, 2008 5:32 PM
To: dev@tuscany.apache.org 
Subject: databinding-jaxb-axiom doesn't do an adjustElementName


I'm noticing a difference in the JAXB->Axiom serialization produced by the new databinding-jaxb-axiom transform compared to the old transform (JAXB2Node, Node2XMLStreamReader,XMLStreamReader2OMElement).

The difference is caused by the fact that the older transform (before databinding-jaxb-axiom) had a call out to DOMHelper.adjustElementName() to, like the method name suggests, adjust the element name to the one calculated by tuscany-interfacedef processing, rather than relying only on JAXB APIs to calculate the interface name.

Before I go into detail with my test app, (which I think I want to change anyway), let me just ask this:  did we intend to make the same "adjustment" with databinding-jaxb-axiom?  

I'm not 100% sure of the reason for doing the adjustment in the older code, so I just wanted to start with that question before bothering with my test details.

Thanks,
Scott