users@jaxb.java.net

Re: How to customize JAXB (XJC) to imitate _at_XmlElementWrapper

From: sr_ren <srini_rengasamy_at_hotmail.com>
Date: Fri, 19 Dec 2008 11:40:27 -0800 (PST)

Hi Ohad,

JAXB seems to be having lots of limitations and all you can do is just
primitive XML serialization and deserialzation.

In my case I wanted the the XML to have
 <Items>
     <Item> </Item>
     <Item> </Item>
      ....
  </Items>
But I did not want the Java class to have "ItemsType" and "ItemType" classes
and always needing to create a wrapper class.
JAXB @XmlElementWrapper seems to do something to help in this behavior, I
tried but could not find a way to use wrapper item.
JAXB behavior is only just one way, you don't have any way to tell the XSD
to Java code generator to generate Java code with @XmlElementWrapper. I find
this to be very strange

Finally I dropped the requirement of having the wrapper "Items" class and
just living with "Item" alone. It is not bad and I started find out reasons
living without the wrapper element. I found it is OK to live without the
wrapper class and all XPath usages are still not bad.

Best Regards,
sr


-- 
View this message in context: http://www.nabble.com/How-to-customize-JAXB-%28XJC%29-to-imitate-%40XmlElementWrapper-tp21074055p21097226.html
Sent from the java.net - jaxb users mailing list archive at Nabble.com.