There is a common pattern in XML to have plural elements, as in:
<bar>
<foos>
<foo/>
<foo/>
<foo/>
</foos>
</bar>
The plural element "foos" is used to group zero or more "foo" elements.
Left by itself, JAXB will give you the following structure:
class Bar {
Foos getFoos();
void setFoos(Foos obj);
}
class Foos {
List getFoo(); // a list of Foo objects
}
But you don't want that. That's annoying. The plural object
is not appropriate to typical OOP. What you want a more logical
structure like this:
class Bar {
List getFoos(); // a list of Foo objects
}
The way to achieve the logical structure, do this:
<define name="Foos">
<element name="foos">
<jaxb:property collectionType="java.util.List"/>
<zeroOrMore>
<ref name="Foo"/>
</zerOrMore>
</element>
</define>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
For additional commands, e-mail: users-help_at_jaxb.dev.java.net