Re: AW: [castor-dev] Castor-JAXB Interoperability
Werner Guttmann <[email protected]> Mon, 03 May 2010 09:52:44 +0200
| Newsgroups | gmane.comp.java.castor.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi Martin, a first comment has been posted in the JIRA issue. Cheers Werner On 29.04.2010 18:15, [email protected] wrote: > Thanks for your early reply Ralf. I've created a new jira issue as you suggested and attached a test case. > For everyone who's interested in the topic of Castor-JAXB Interoperability: > > http://jira.codehaus.org/browse/CASTOR-2904 > > > Regards > > Martin > > -----Ursprüngliche Nachricht----- > Von: Ralf Joachim [mailto:[email protected]] > Gesendet: Mittwoch, 28. April 2010 23:31 > An: [email protected] > Betreff: Re: [castor-dev] Castor-JAXB Interoperability > > Hi Martin, > > we appreciate any effort to make Castor more compatible with JAXB. > > I suggest you to create a new jira issue for the problem at hand a > attach a minimal test case to replay the problem. I think Werner, who is > the one familiar with that part of Castor, will take it from there. > > Regards > Ralf > > > [email protected] schrieb: >> >> Hello everyone, >> >> >> >> I would like to extend / modify Castor to be enable it to unmarhal XML >> that has been created by a JAXB reference implementation >> >> but don’t know where to start. I would be grateful if anyone could >> provide an idea. Thanks in advance. >> >> >> >> Motivation: >> >> I'm currently facing a problem in unmarshalling XML that has been >> created by a JAXB implementation with Castor. >> >> I'm wondering if it is possible to do that without specifying any >> Castor-Mapping information. >> >> Basically with simple properties it works >> (org.exolab.castor.xml.naming=mixed) but the problems arise when >> collection types >> >> are involved as the way collections are marshalled/unmarshalled in >> JAXB and Castor are slightly different. >> >> >> >> Demonstration: >> >> >> >> JavaSrc: >> >> ... >> >> private Map<Integer, Drink> drinkList; >> >> ... >> >> >> >> public class Drink { >> >> private String drinkName; >> >> private Float price; >> >> private int alcoholByVolume; >> >> } >> >> >> >> JAXB marshalling of JavaSrc: >> >> ... >> >> <drinkList> >> >> <entry> >> >> <key>1</key> >> >> <value> >> >> <alcoholByVolume>0</alcoholByVolume> >> >> <drinkName>Soda</drinkName> >> >> <price>0.99</price> >> >> </value> >> >> </entry> >> >> <entry> >> >> <entry> >> >> <key>2</key> >> >> <value> >> >> <alcoholByVolume>0</alcoholByVolume> >> >> <drinkName>Tonic</drinkName> >> >> <price>1.99</price> >> >> </value> >> >> </entry> >> >> <entry> >> >> </drinkList> >> >> ... >> >> >> >> Castor produces something like this when marshalling in reflection-mode: >> >> ... >> >> <drinkList xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >> xmlns:java="http://java.sun.com" >> xsi:type="java:org.exolab.castor.mapping.MapItem"> >> >> <key xsi:type="java:java.lang.Integer">1</key> >> >> <value alcoholByVolume="0" xsi:type="java:collectionMapping.Drink"> >> >> <drinkName>Soda</drinkName> >> >> <price>0.99</price> >> >> </value> >> >> </drinkList> >> >> <drinkList xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >> xmlns:java="http://java.sun.com" >> xsi:type="java:org.exolab.castor.mapping.MapItem"> >> >> <key xsi:type="java:java.lang.Integer">2</key> >> >> <value alcoholByVolume="0" xsi:type="java:collectionMapping.Drink"> >> >> <drinkName>Tonic</drinkName> >> >> <price>1.99</price> >> >> </value> >> >> </drinkList> >> >> ... >> >> >> >> Greetings, >> >> >> >> Martin >> --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email