Hi
Can this be a good example for the choice?
.
.
.
<xs:complexType name="listType">
<xs:sequence>
<xs:element name="display-name"
type="display-nameType" minOccurs="0" />
<xs:sequence minOccurs="0"
maxOccurs="unbounded">
<xs:choice>
<xs:element name="list">
<xs:complexType>
<xs:complexContent>
<xs:extension base="listType" />
</xs:complexContent>
</xs:complexType>
</xs:element>
<xs:element name="external"
type="externalType" />
<xs:element name="entry"
type="entryType" />
<xs:element name="entry-ref"
type="entry-refType" />
</xs:choice>
</xs:sequence>
<xs:any namespace="##other"
processContents="lax" minOccurs="0" maxOccurs="unbounded" />
</xs:sequence>
<xs:attribute name="name" type="xs:string"
use="optional" />
<xs:anyAttribute namespace="##other"
processContents="lax" />
</xs:complexType>
.
.
.
Lulseged
-----Original Message-----
From: John Leonard [mailto:jleonard.20081_at_gmx.com]
Sent: den 22 november 2009 01:47
To: users_at_jaxb.dev.java.net
Subject: XJC and "choice" element.
Does JAXB understand the following use of the "choice" element?
<choice minOccurs="0" maxOccurs="unbounded">
<element...
<element...
...
</choice>
Here is the output of XJC when I run it from the command line on a file
containing such code:
parsing a schema...
compiling a schema...
[INFO] generating code
unknown location
Exception in thread "main"
java.lang.reflect.UndeclaredThrowableException
at $Proxy7.required(Unknown Source)
at
com.sun.tools.xjc.generator.bean.field.AbstractField.annotateReferenc
e(AbstractField.java:197)
at
com.sun.tools.xjc.generator.bean.field.AbstractField.annotate(Abstrac
tField.java:156)
at
com.sun.tools.xjc.generator.bean.field.AbstractListField.generate(Abs
tractListField.java:124)
at
com.sun.tools.xjc.generator.bean.field.UntypedListField.<init>(Untype
dListField.java:107)
at
com.sun.tools.xjc.generator.bean.field.UntypedListFieldRenderer.gener
ate(UntypedListFieldRenderer.java:72)
at
com.sun.tools.xjc.generator.bean.field.DefaultFieldRenderer.generate(
DefaultFieldRenderer.java:79)
at
com.sun.tools.xjc.generator.bean.BeanGenerator.generateFieldDecl(Bean
Generator.java:747)
at
com.sun.tools.xjc.generator.bean.BeanGenerator.generateClassBody(Bean
Generator.java:535)
at
com.sun.tools.xjc.generator.bean.BeanGenerator.<init>(BeanGenerator.j
ava:235)
at
com.sun.tools.xjc.generator.bean.BeanGenerator.generate(BeanGenerator
.java:175)
at com.sun.tools.xjc.model.Model.generateCode(Model.java:286)
at com.sun.tools.xjc.Driver.run(Driver.java:343)
at com.sun.tools.xjc.Driver.run(Driver.java:191)
at com.sun.tools.xjc.Driver._main(Driver.java:116)
at com.sun.tools.xjc.Driver.access$000(Driver.java:74)
at com.sun.tools.xjc.Driver$1.run(Driver.java:96)
Caused by: java.lang.NoSuchMethodException:
javax.xml.bind.annotation.XmlElement
Ref.required()
at java.lang.Class.getDeclaredMethod(Unknown Source)
at
com.sun.codemodel.TypedAnnotationWriter.invoke(TypedAnnotationWriter.
java:107)
... 17 more
Thanks,
John L.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
For additional commands, e-mail: users-help_at_jaxb.dev.java.net