E
Eric
Attached is an example of my question. Note the "values" attribute is
optional. Also the <value> sub-element is optional. Here, the XML
can contain, 1 or both or neither. I would like to allow EITHER the
"values" attribute or <value> sub-elements - but not both.
I tried using a <choice> with two element definitions for
"characteristic" with different content, but this is clearly not
allowed in XSD.
Does anyone have an answer? Thanks.
========================================================================
<xs:element name="characteristics">
<xs:complexType>
<xs:sequence>
<xs:element name="characteristic">
<xs:complexType>
<xs:sequence>
<xs:element name="value" minOccurs="0"
maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="value" type="xs:string"
use="required" />
<xs:attribute name="description" type="xs:string"
use="optional" />
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="name" type="xs:NMTOKEN"
use="optional" />
<xs:attribute name="values" type="xs:string"
use="optional" />
<xs:attribute name="column" type="xs:NMTOKEN"
use="required" />
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
optional. Also the <value> sub-element is optional. Here, the XML
can contain, 1 or both or neither. I would like to allow EITHER the
"values" attribute or <value> sub-elements - but not both.
I tried using a <choice> with two element definitions for
"characteristic" with different content, but this is clearly not
allowed in XSD.
Does anyone have an answer? Thanks.
========================================================================
<xs:element name="characteristics">
<xs:complexType>
<xs:sequence>
<xs:element name="characteristic">
<xs:complexType>
<xs:sequence>
<xs:element name="value" minOccurs="0"
maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="value" type="xs:string"
use="required" />
<xs:attribute name="description" type="xs:string"
use="optional" />
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="name" type="xs:NMTOKEN"
use="optional" />
<xs:attribute name="values" type="xs:string"
use="optional" />
<xs:attribute name="column" type="xs:NMTOKEN"
use="required" />
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>