You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Anthony Schexnaildre <ap...@gmail.com> on 2008/08/13 19:39:37 UTC
JAXB Map Advice
Hi all,
I know this not necessarily CXF specific but I though some here may
have the experience to give me some hints. I checked the JAXB list and
saw a similar question but it went unanswered.
I want to marshall a map to XML which I can do follow the many
articles on the internet and using a XmlAdapter. Which gives me
something like:
<mapHolder>
<txnMap>
<txnMapEntry blah="version">111</txnMapEntry>
<txnMapEntry blah="request">PULL</txnMapEntry>
<txnMapEntry blah="srcId">4080263668</txnMapEntry>
</txnMap>
</mapHolder>
However I want the XML to look like:
<txnMap>
<version>111</version>
<request>PULL</request>
<srcId>4080263668</srcId>
</txnMap>
I have tried a million different combinations of annotations to
experiment. I also would not be at all opposed to using ASM to
transform or write new byte code into classes but I just don't know
the correct approach to take or if this is really possible at all.
Should I let JAXB rip out any xml it wants and then transform it some
place else in the CXF pipeline? Anyone have experience here?
-Anthony
Re: JAXB Map Advice
Posted by Anthony Schexnaildre <ap...@gmail.com>.
Solved! For anyone else that is doing this and using JAX-RS just write
a simple MessageBodyProvider. Don't waste time with JAXB.
-Anthony
On Aug 13, 2008, at 1:39 PM, Anthony Schexnaildre wrote:
> Hi all,
>
> I know this not necessarily CXF specific but I though some here may
> have the experience to give me some hints. I checked the JAXB list
> and saw a similar question but it went unanswered.
>
> I want to marshall a map to XML which I can do follow the many
> articles on the internet and using a XmlAdapter. Which gives me
> something like:
>
> <mapHolder>
> <txnMap>
> <txnMapEntry blah="version">111</txnMapEntry>
> <txnMapEntry blah="request">PULL</txnMapEntry>
> <txnMapEntry blah="srcId">4080263668</txnMapEntry>
> </txnMap>
> </mapHolder>
>
> However I want the XML to look like:
>
> <txnMap>
> <version>111</version>
> <request>PULL</request>
> <srcId>4080263668</srcId>
> </txnMap>
>
> I have tried a million different combinations of annotations to
> experiment. I also would not be at all opposed to using ASM to
> transform or write new byte code into classes but I just don't know
> the correct approach to take or if this is really possible at all.
> Should I let JAXB rip out any xml it wants and then transform it
> some place else in the CXF pipeline? Anyone have experience here?
>
> -Anthony