What is the difference between xs:group and xs:extension in XSD

R

RC

Please see the example below. What is/are the difference(s)
between xs:group and xs:extension

<xs:complexType name="personinfo">
<xs:sequence>
<xs:element name="firstname" type="xs:string"/>
<xs:element name="lastname" type="xs:string"/>
</xs:sequence>
</xs:complexType>

<xs:group name="mailinginfo">
<xs:sequence>
<xs:element name="address" type="xs:string"/>
<xs:element name="city" type="xs:string"/>
<xs:element name="state" type="xs:string" />
<xs:element name="zipcode" type="xs:string" />
</xs:sequence>
</xs:group>

<xs:complexType name="fullpersoninfo">
<xs:complexContent>
<xs:extension base="personinfo">
<xs:sequence>
<xs:group ref="mailinginfo" />
<xs:element name="country" type="xs:string"/>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>

<xs:element name="employee" type="fullpersoninfo"/>
 
Joined
May 24, 2011
Messages
1
Reaction score
0
It is the difference between "has" and "is a" relationship in Oops.

It is the difference between "has" and "is a" relationship in Oops.

For ex., if I have two classes A and B.

I can access/use the public datas from A, by inheriting(extending) class B. or I can create an Instance of B inside A.

Exactly same principle applied on xs:group and xs:extension in XSD.

If you are clarified by my answer, please ack. that.

Thanks
 

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

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top