Leo (archive)
Usenet Archive
- Joined
- Feb 10, 2001
- Messages
- 118
- Reaction score
- 0
Can the value of the union datatype contain leading/trailing white space if it's not allowed by the member datatypes? For example, in the following example:
t1.xsd:
<?xml version="1.0"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.t1.org" xmlns="http://www.t1.org" elementFormDefault="qualified"> <xsd:simpleType name="enum_type"> <xsd:restriction base="xsd:string"> <xsd:enumeration value="enum_type_val_1"/> </xsd:restriction> </xsd:simpleType> <xsd:simpleType name="union_type"> <xsd:union memberTypes="enum_type"/> </xsd:simpleType> <xsd:element name="root"> <xsd:complexType> <xsd:sequence> <xsd:element name="elem_1" type="union_type" maxOccurs="unbounded"/> </xsd:sequence> </xsd:complexType> </xsd:element> </xsd:schema>
t1.xml:
<?xml version="1.0"?>
<root xmlns="http://www.t1.org"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.t1.org t1.xsd"> <elem_1> enum_type_val_1 </elem_1> </root>
Should the validator reject elem_1 value because of the both leading/trailing white space?
Xerces-C 2.5 does not. However, if enum_type is used directly, without the union, then Xerces raises an error, stating that "Message:Value ' enum_type_val_1 ' is not in enumeration"
Thanks,
Leo.
t1.xsd:
<?xml version="1.0"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.t1.org" xmlns="http://www.t1.org" elementFormDefault="qualified"> <xsd:simpleType name="enum_type"> <xsd:restriction base="xsd:string"> <xsd:enumeration value="enum_type_val_1"/> </xsd:restriction> </xsd:simpleType> <xsd:simpleType name="union_type"> <xsd:union memberTypes="enum_type"/> </xsd:simpleType> <xsd:element name="root"> <xsd:complexType> <xsd:sequence> <xsd:element name="elem_1" type="union_type" maxOccurs="unbounded"/> </xsd:sequence> </xsd:complexType> </xsd:element> </xsd:schema>
t1.xml:
<?xml version="1.0"?>
<root xmlns="http://www.t1.org"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.t1.org t1.xsd"> <elem_1> enum_type_val_1 </elem_1> </root>
Should the validator reject elem_1 value because of the both leading/trailing white space?
Xerces-C 2.5 does not. However, if enum_type is used directly, without the union, then Xerces raises an error, stating that "Message:Value ' enum_type_val_1 ' is not in enumeration"
Thanks,
Leo.