How does union datatype handle leading/trailing white space?

Discussion in 'XML' started by Leo, Aug 31, 2004.

  1. Leo

    Leo Guest

    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.
     
    Leo, Aug 31, 2004
    #1
    1. Advertisements

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Les Caudle
    Replies:
    0
    Views:
    798
    Les Caudle
    Mar 7, 2004
  2. Maxime Biais

    print and trailing white space

    Maxime Biais, Sep 18, 2003, in forum: Python
    Replies:
    4
    Views:
    453
    M-a-S
    Sep 19, 2003
  3. Ben C
    Replies:
    6
    Views:
    2,468
    Leif K-Brooks
    Jan 28, 2007
  4. Generic Usenet Account

    Trimming leading and trailing spaces from a string

    Generic Usenet Account, Jul 8, 2005, in forum: C++
    Replies:
    6
    Views:
    573
    Paul Groke
    Jul 13, 2005
  5. John B. Matthews
    Replies:
    4
    Views:
    949
    John B. Matthews
    Sep 12, 2008
  6. Roedy Green
    Replies:
    3
    Views:
    847
  7. Ramon F Herrera
    Replies:
    15
    Views:
    1,264
    Francesco
    Sep 9, 2009
  8. johkar
    Replies:
    2
    Views:
    3,912
    Mayeul
    Dec 10, 2009
Loading...