Hi.
> I've compiled the following XSD :
>
> [code]
>
> <?xml version="1.0" encoding="UTF-8"?>
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
> <xs:element name="root">
> <xs:complexType>
> <xs:sequence>
> <xs:group ref="content"
> maxOccurs="unbounded"/>
> </xs:sequence>
> </xs:complexType>
> </xs:element>
> <xs:group name="content">
> <xs:choice>
> <xs:element name="a" type="elemset" minOccurs="0"/>
> <xs:element name="b" type="elemset" minOccurs="0"/>
> <xs:element name="id" type="xs:int" minOccurs="0"/>
> </xs:choice>
> </xs:group>
> <xs:complexType name="elemset">
> <xs:sequence>
> <xs:element name="elem" type="xs:string"
> minOccurs="0" maxOccurs="unbounded"/>
> </xs:sequence>
> </xs:complexType>
> </xs:schema>
>
> [/code]
>
>
> but it resulted into the following JAVA code :
>
> [code]
>
> public List<JAXBElement<?>> getContent() {
> if (content == null) {
> content = new ArrayList<JAXBElement<?>>();
> }
> return this.content;
> }
>
> [/code]
>
>
> Is it the expected behaviour ? Why isn't it a List<Object> ? What can I do
> knowing I'm unable to modify this XSD since it's provided by a third part ?
Yes, its is the correct behaviour. It's not List<Object> since Object
won't know anything about the name of the element it represents.
Your options are:
1. Work with JAXBElements instead (one more getter call).
2. Annotate with jaxb:dom and work with DOM elements instead.
Bye.
/lexi