Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: Selection of enumerated simpleType should offer sub-attributes based on selection

From: Alexander Veit <list@-------.-->
To: xmlschema-dev@--.---
Date: 3/10/2007 2:46:00 PM
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


From swvemuri@c... Mon Mar 12 04:04:45 2007
Received: from aji.w3.org ([133.27.228.225])
	by fri


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent