users@jaxb.java.net

element substitution question

From: Chuck H. Zhao <czhao_at_visionmonitor.com>
Date: Thu, 25 Dec 2003 19:26:21 -0600

I have two elements like the following and would like to use element
substitution:

<single name="name1">foo</param>

<multi name="name2">
        <val>foo</val>
        <val>bar</val>
</multi>

I defined the schema for base type param and <multi>:

   <xs:complexType name="param">
     <xs:attribute name="name" type="xs:string" use="required" />
   </xs:complexType>

   <xs:element name="paramE" type="param" abstract="true" />

   <xs:element name="multi" substitutionGroup="paramE">
     <xs:complexType>
       <xs:complexContent>
         <xs:extension base="param">
           <xs:sequence>
             <xs:element name="val" type="xs:string" minOccurs="0"
maxOccurs="unbounded"/>
           </xs:sequence>
         </xs:extension>
       </xs:complexContent>
     </xs:complexType>
   </xs:element>

Now how do I define <single> element as derived from the base type
param? I only know to define <single> as extension of xs:string, but that
won't work with substitutionGroup.
I know I can always resort to do <single
name="name1"><val>foo</val></param>, but I just hope I can do without the
<val> here. Any ideas?

-- Chuck


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
For additional commands, e-mail: users-help_at_jaxb.dev.java.net