users@jaxb.java.net

Re: [jaxb]can not generate right jaxb object

From: Jason Harrop <jharrop_at_gmail.com>
Date: Mon, 28 Apr 2008 15:27:56 +1000

What does it contain - presumably JAXBElement? If so, and its name is
paragraph, use the getValue() method cast it to paragraph.

On Mon, Apr 28, 2008 at 2:21 PM, zhangzhongliang
<zhangzhongl_at_neusoft.com> wrote:
>
>
> hi,
>
> I got a problem with generate jaxb object from a xml fragment.
> The schema is like following:
>
>
>
> <xs:group name="contents">
>
> <xs:choice>
>
> <xs:element ref="graphic"/>
>
> <xs:element ref="table"/>
>
> <xs:element ref="list"/>
>
> <xs:element ref="link"/>
>
> <xs:element ref="paragraph"/>
>
> </xs:choice>
>
> </xs:group>
>
>
>
> <xs:element name="clause">
>
> <xs:complexType>
>
> <xs:sequence>
>
> <xs:element ref="paragraph"/>
>
> <xs:group ref="contents" minOccurs="0" maxOccurs="unbounded"/>
>
> <xs:element ref="sub_clause" minOccurs="0"
> maxOccurs="unbounded"/>
>
> </xs:sequence>
>
> </xs:complexType>
>
> </xs:element>
>
> If I generate a Java Clause object with the following xml fragment:
>
> <clause id="ID_416303">
>
> <paragraph>paragraph1</paragraph>
>
> <paragraph>paragraph2</paragraph>
>
> <paragraph>paragraph3</paragraph>
> </clause>
>
> the Clause.getContents() method return a List<Object> which does not contain
> any Paragraph instance.
>
> Anybody ever got this problem?
>
> thanks in advance.