----- Forwarded by Jeffrey Kramer/USA/DDS on 10/29/2008 04:53 PM -----
Hi Werner,
I should have mentioned initially this is Castor version 1.2 on a windows
xp machine with java version 1.5.0_16.
It looks like the major question here is how Castor is handling the
attributes of the Choice elements & it's respective nested simple elements
under the following assumption:
The expression <xs:choice maxOccurs="unbounded"> allows the contents to be
repeated one or more times.
The expression <xs:element name="X" maxOccurs="unbounded"> allows the
single element to be repeated one or more times
For xml containing:
...
<foo>1</foo>
<foo>2</foo>
<office>NY</office>
...
I've observed the following cases:
(1) maxOccurs attribute set in choice element
<xs:choice maxOccurs="unbounded">
<xs:element name="foo" type="xs:string" minOccurs="1" />
</xs:choice>
=> works without error
(2) Here the case where the choice element does not have a maxOccurs
attribute set ( default = 1)
<xs:choice >
<xs:element name="foo" type="xs:string" minOccurs="1"
maxOccurs="unbounded" />
</xs:choice>
<office>NY</office>
=> throws the following exception:
-- org.exolab.castor.xml.MarshalException: Element with name foo passed to
type companyEmployee in incorrect order; expected element with name
'office' or any other optional element declared prior to it.{File: [not
available]; line: 9; column: 7}
This 2nd case is actually a format we're interested in using. Any
insight or suggestion you may be able to provide would be greatly
appreciated.
Thanks,
Jeff