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.
 

Reply via email to