M
monique
Hi,
I have an enumeration and I would like to fix the value of an element.
A thing like this
<?xml version="1.0"?>
<test>
<single-value>aaa</single-value>
</test>
with the schema:
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:element name="test">
<xs:complexType>
<xs:sequence>
<xs:element name="single-value"
type="single-value-type" fixed="aaa" maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:simpleType name="single-value-type">
<xs:restriction base="xs:string">
<xs:enumeration value="aaa" />
<xs:enumeration value="bbb" />
<xs:enumeration value="ccc" />
</xs:restriction>
</xs:simpleType>
</xs:schema>
the example validates against the schema and so do this:
<?xml version="1.0"?>
<test>
<single-value/>
<single-value>aaa</single-value>
</test>
I don't want an empty single-value.
What can I do ?
This example
<?xml version="1.0"?>
<test>
<single-value/>
<single-value>aaa</single-value>
<single-value>bbb</single-value>
<single-value>ccc</single-value>
</test>
doesn't validate on bbb and ccc, just as I need.
I would like to get the same on <single-value/>.
Thanks in advance,
Monique
I have an enumeration and I would like to fix the value of an element.
A thing like this
<?xml version="1.0"?>
<test>
<single-value>aaa</single-value>
</test>
with the schema:
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:element name="test">
<xs:complexType>
<xs:sequence>
<xs:element name="single-value"
type="single-value-type" fixed="aaa" maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:simpleType name="single-value-type">
<xs:restriction base="xs:string">
<xs:enumeration value="aaa" />
<xs:enumeration value="bbb" />
<xs:enumeration value="ccc" />
</xs:restriction>
</xs:simpleType>
</xs:schema>
the example validates against the schema and so do this:
<?xml version="1.0"?>
<test>
<single-value/>
<single-value>aaa</single-value>
</test>
I don't want an empty single-value.
What can I do ?
This example
<?xml version="1.0"?>
<test>
<single-value/>
<single-value>aaa</single-value>
<single-value>bbb</single-value>
<single-value>ccc</single-value>
</test>
doesn't validate on bbb and ccc, just as I need.
I would like to get the same on <single-value/>.
Thanks in advance,
Monique