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

Discussion in 'XML' started by RC, Mar 6, 2008.

  1. RC

    RC Guest

    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"/>
     
    RC, Mar 6, 2008
    #1
    1. Advertising

  2. RC

    pyarkushi

    Joined:
    May 24, 2011
    Messages:
    1
    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
     
    pyarkushi, May 24, 2011
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. jakk
    Replies:
    4
    Views:
    12,511
  2. Bernd Oninger
    Replies:
    1
    Views:
    549
    Henry S. Thompson
    Jun 30, 2004
  3. Replies:
    18
    Views:
    1,113
    Tomi Häsä
    Jan 22, 2005
  4. Martin Honnen
    Replies:
    0
    Views:
    1,513
    Martin Honnen
    Apr 15, 2008
  5. KC

    Difference between Extension and Fitlers

    KC, Jul 27, 2003, in forum: ASP .Net Web Services
    Replies:
    0
    Views:
    113
Loading...

Share This Page