Altova Mailing List Archives>Archive Index >comp.text.xml Archive Home >Recent entries [Thread Prev] >Thread Next - Re: Get exactly one choice element Get exactly one choice elementTo: NULL Date: 12/1/2004 2:12:00 AM Hi; I try to limit the selection of elements to exactly one. I have to do it by using elements, attributes are no alternativ. If I use the configuration shown below, it is also possible to select no element. If I set minOccurs to 1 at both elements, I have to select both. How I can can define that just one and no more than one element are allowed? Thx for your help! If I have the following xsd: ---------------------------------------------- <?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:element name="test"> <xs:complexType> <xs:choice> <xs:element name="element1" minOccurs="0"/> <xs:element name="element2" minOccurs="0"/> </xs:choice> </xs:complexType> </xs:element> </xs:schema> and the following xml should not be allowed: ----------------------------------------------- <?xml version="1.0" encoding="UTF-8"?> <test xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="schematest.xsd"> </test> | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
