Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Question about Extension

 
Himal Chuli
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi guys,
i've the following;
<xs:element name="shoesize">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:integer">
<xs:attribute name="country" type="xs:string" />
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
what's implication of using extension in the above? could someone please explain it?
appreciate.
himal
 
Jayadev Pulaparty
Ranch Hand
Posts: 662
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It means that we are extending a simpleType to have an attribute. If you extend a complexType, you should have a complexContent rather.
 
Himal Chuli
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
we are extending an integer and again defining it as being string. it's kinda confusing to me..so what type of value the attribute's gonna hold now?
could you please explain it?
himal
 
Jayadev Pulaparty
Ranch Hand
Posts: 662
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Integer is the element(shoesize) content type and string is the attribute(country) content type.
Eg: <shoesize country="USA">8</shoesize>
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic