tags:

views:

79

answers:

1

Hi everybody.

I used JAXB to create some classes from an XSD. The result was not quite what I expected and most probably it can be customized.

It created a generic list instead of 3 different lists. Can this be corrected somehow?

@XmlElements({
    @XmlElement(name = "M1", type = M1_Type.class),
    @XmlElement(name = "M2", type = M2_Type.class),
    @XmlElement(name = "M3", type = M3_Type.class)
})

protected List<Object> m1Orm2OrM3;

Is there a customization to fix this?

A: 

You probably have a repeatable choice, something like

<choice maxOccurs="unbounded">
  <element name="M1" .../>
  <element name="M2" .../>
  <element name="M3" .../>
</choice>

The answer is negative, there's no such customization. "Three list" is actually a very different data structure.

lexicore