[jboss-dev-forums] [Design of JBossXB] - Re: @XmlElementWrapper/@XmlElements

scott.stark@jboss.org do-not-reply at jboss.com
Wed Oct 10 10:01:00 EDT 2007


I don't see that you can make a meanignful distinction between these two fragments:


  |     <!-- XML Schema fragment -->
  |     <xs:complexType name="Foo">
  |       <xs:sequence>
  |         <xs:element name="bar" minOccurs="1" maxOccurs="unbounded">
  |           <xs:complexType>
  |             <xs:choice minOccurs="0" maxOccurs="unbounded">
  |               <xs:element name="A" type="PX"/>
  |               <xs:element name="B" type="PY"/>
  |             </xs:choice>
  |           </xs:complexType>
  |         </xs:element>
  |       </xs:sequence>
  |     </xs:complexType>
  | 


  |     <!-- XML Schema fragment -->
  |     <xs:complexType name="Foo">
  |         <xs:sequence>
  |             <xs:element name="bar" minOccurs="1" maxOccurs="unbounded">
  |                 <xs:complexType>
  |                     <xs:choice minOccurs="0" maxOccurs="1">
  |                         <xs:element name="A" type="xs:string"/>
  |                         <xs:element name="B" type="xs:string"/>
  |                     </xs:choice>
  |                 </xs:complexType>
  |             </xs:element>
  |         </xs:sequence>
  |     </xs:complexType>
  | 

both accept:


  | <foo>
  |    <bar>
  |       <A />
  |    </bar>
  |    <bar>
  |       <B />
  |    </bar>
  |    <bar>
  |       <A />
  |    </bar>
  | </foo>
  | 

and since the  @XmlElementWrapper should be flattening out the bar elements to its children, both end up with a List of the choice elements. 


View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4093502#4093502

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4093502



More information about the jboss-dev-forums mailing list