How does union datatype handle leading/trailing white space?

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.
 

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

No members online now.

Forum statistics

Threads
548,208
Messages
3,104,802
Members
249,594
Latest member
henrywalsh

Latest Threads

Top