[xsde-users] Cannot get the value

Boris Kolpackov boris at codesynthesis.com
Wed Jun 25 09:25:20 EDT 2008


Hi Khuong,

Khuong Nguyen Thi Lien <ntlkhuong at tma.com.vn> writes:

> <xs:complexType name="configNameType"/>
> 
>             <xs:element name="config-name" type="configNameType"
> abstract="true"/>
> 
>             <xs:element name="startup" type="configNameType"
> substitutionGroup="config-name"/>
> 
>             <xs:element name="candidate" type="configNameType"
> substitutionGroup="config-name"/>
> 
>             <xs:element name="running" type="configNameType"
> substitutionGroup="config-name"/>
> 

This schema does not make much sense since the elements that substitute
config-name (startup, candidate, and running) all use the same type as
config-name. Normally you would have types derived from configNameType
for startup, candidate, and running, for example (normally such types
would also include additional elements/attributes):

<xs:complexType name="startupType">
  <complexContent>
    <extension base="configNameType"/>
  </complexContent>
</xs:complexType>

<xs:element name="startup" type="startupType" 
            substitutionGroup="config-name"/>

<xs:complexType name="candidateType">
  <complexContent>
    <extension base="configNameType"/>
  </complexContent>
</xs:complexType>

<xs:element name="candidate" type="candidateType" 
            substitutionGroup="config-name"/>

<xs:complexType name="runningType">
  <complexContent>
    <extension base="configNameType"/>
  </complexContent>
</xs:complexType>

<xs:element name="running" type="runningType" 
            substitutionGroup="config-name"/>


Then you would implement parser skeletons for each of them and
add them to the map that is used to parse config-name. During
parsing, depending on the actual element name found in XML (e.g.,
running, startup, etc.), the corresponding parser skeleton will
be executed.

Boris




More information about the xsde-users mailing list