How does union datatype handle leading/trailing white space?

L

Leo

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,997
Messages
2,570,241
Members
46,830
Latest member
HeleneMull

Latest Threads

Top