Question about xsd:extension

A

Amol

Hi all,
I have a case where I have a element that can appear under multiple
elements
e.g.
<AppFunctions>
<UseTemplate name="1"/>
<MethodSet name="2">
<UseTemplate name="3" />
<MethodCall name="4" />
</MethodSet>
<MethodSet name="5">
<MethodCall name="6" />
</MethodSet>
<UseTemplate name="7" />
</AppFunctions>

I would like a way to define a root element which has just the
UseTemplate element and then derive 2 elements from it "AppFunctions"
and "MethodSet" which extend it to add further elements to it. This
elements in the derived elements need to unordered and can occur
multiple times. This is what I came up with:

<xs:complexType name="UIElementType">
<xs:choice maxOccurs="unbounded">
<xs:element name="UseTemplate" type="UseTemplateType" minOccurs="0"
maxOccurs="unbounded" />
</xs:choice>
</xs:complexType>

<xs:complexType name="AppFunctionType">
<xs:complexContent>
<xs:extension base="UIElementType">
<xs:choice maxOccurs="unbounded">
<xs:element name="MethodSet" type="MethodSetType"
maxOccurs="unbounded" />
</xs:choice>
</xs:extension>
</xs:complexContent>
</xs:complexType>

<xs:complexType name="MethodSetType">
<xs:complexContent>
<xs:extension base="UIElementType">
<xs:choice maxOccurs="unbounded">
<xs:element name="MethodCall" type="MethodCallType" minOccurs="0"
maxOccurs="unbounded" />
</xs:choice>
<xs:attribute name="name" type="xs:string" use="required" />
</xs:extension>
</xs:complexContent>
</xs:complexType>

This definition is allowing me mutiple UseTemplate nodes directly under
AppFunctions but once I add a MethodSet node under AppFunctions, it
does not allow any UseTemplates anymore.

Thanx in advance,
Amol.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,001
Messages
2,570,255
Members
46,853
Latest member
GeorgiaSta

Latest Threads

Top