- From: Alexander Veit <list@nezwerg.de>
- Date: Sat, 10 Mar 2007 13:45:39 +0100
- To: xmlschema-dev@w3.org
Swayam Vemuri -X (swvemuri - WIPRO at Cisco) wrote: > Hi, > > I have a requirement wherein, I have a enumerated > simpleType/complexType, like as shown below > > <xs:simpleType name="HibernateCollectionElements"> > <xs:restriction base="xs:string"> > <xs:enumeration value="Set"/> > <xs:enumeration value="Bag"/> > <xs:enumeration value="List"/> > </xs:restriction> > </xs:simpleType> > > Now based on the user selection(that is Set or Bag or List) , > > I need to present a set of attributes. This set of attributes is > different for different values given in enumerated value set. > > That is if user selects Set, then he will be given attributes s1, s2 and s3. > If user selects Bag, then he will be given attributes h1, h2 and so on. > > Can any one please let me know how to have above logic in a xsd, with an > example. Do you mean something like <xs:complexType name="tBase"> </xs:complexType> <xs:complexType name=tBaseWithSetAttributes> <xs:complexContent> <xs:extension base="tBase"> <xs:attribute name="type" type="tns:HibernateCollectionElements" fixed="Set"/> <xs:attribute name="s1" type="xs:string"/> <xs:attribute name="s2" type="xs:string"/> <xs:attribute name="s3" type="xs:string"/> </xs:extension> </xs:complexContent> </xs:complexType> <xs:complexType name=tBaseWithBagAttributes> <xs:complexContent> <xs:extension base="tBase"> <xs:attribute name="type" type="tns:HibernateCollectionElements" fixed="Bag"/> <xs:attribute name="h1" type="xs:string"/> <xs:attribute name="h2" type="xs:string"/> </xs:extension> </xs:complexContent> </xs:complexType> ... -- Regards, Alex
Received on Monday, 12 March 2007 04:02:51 UTC