Afaik you will have a getXXXChoice() somewhere in your item, from which
you can use getColor() and/or getWeight().
You will have to check for null to know which one is used.
h z schrieb:
Hi, all
If a schema contains <xsd:choice>, the generated java files will create
some XXXChoice.java and XXXChoiceItem.java.
How can I get the data stored in Choice item from a XML file?
For example,
the schema like:
<xsd:element name="item">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Quantity" type="xsd:integer" minOccurs="1"
maxOccurs="1" />
<xsd:element name="Price" type="PriceType" minOccurs="1" maxOccurs="1" />
<xsd:*choice* maxOccurs="unbounded">
* <xsd:element name="color" type="colorType"/>
* <xsd:element name="weight" type="xsd:integer"/>
</xsd:choice>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
the XML like:
......
<item Id="0.9.5" InStock="true" Category="Open Source Project">
<Quantity>1</Quantity>
<Price>100.00</Price>
<color>red</color>
</item>
.....
How I can get the *color value (red)*in a test.java ?
Thanks in advance.
-------------------------------------------------
If you wish to unsubscribe from this list, please
send an empty message to the following address:
[EMAIL PROTECTED]
-------------------------------------------------