Consider the following XML schema and document:

<xsd:schema targetNamespace="http://example.com/schema"; 
elementFormDefault="qualified"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema";>
    <xsd:element name="CannedComment">
        <xsd:simpleType>
            <xsd:restriction base="xsd:string">
                <xsd:enumeration value="This is a canned comment."/>
                <xsd:enumeration value="This is a canned comment.  Notice the 
double space"/>
            </xsd:restriction>
        </xsd:simpleType>
    </xsd:element>
</xsd:schema>

<CannedComment xmlns="http://example.com/schema";>This is a canned comment.  
Notice the double space</CannedComment>

When Xerces-C++ is used to validate this document against the schema, it passes 
validation, as expected; however, consider the following modified version of 
the XML schema:

<xsd:schema targetNamespace="http://example.com/schema"; 
elementFormDefault="qualified"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema";>
    <xsd:element name="CannedComment">
        <xsd:simpleType>
            <xsd:union>
                <xsd:simpleType>
                    <xsd:restriction base="xsd:string">
                        <xsd:minLength value="1"/>
                        <xsd:maxLength value="48"/>
                    </xsd:restriction>
                </xsd:simpleType>
                <xsd:simpleType>
                    <xsd:restriction base="xsd:string">
                        <xsd:enumeration value="This is a canned comment."/>
                        <xsd:enumeration value="This is a canned comment.  
Notice the double space"/>
                    </xsd:restriction>
                </xsd:simpleType>
            </xsd:union>
        </xsd:simpleType>
    </xsd:element>
</xsd:schema>

As far as I can tell, the document above should still successfully validate 
against this new schema (and incidentally, oXygen agrees with me); however, 
Xerces-C++ fails the document with the following error message:

value 'This is a canned comment. Notice the double space' does not match any 
member types of the union

Notice that, in the error message, the double space has been condensed to a 
single space.  Does this indicate an issue with my schema, an issue in how I am 
using Xerces, or something else?

Thanks for any help you can offer,

Doug Glidden
Software Engineer
The Boeing Company
douglass.a.glid...@boeing.com<mailto:douglass.a.glid...@boeing.com>

Reply via email to