Hi, Doug.

This is a very clear and useful test case demonstrating the issue.
I think you are correct.  Your sample file should validate against either
schema.
I am ccing the c-dev@xerces list because it appears to be a bug in Xerces
itself.

We've been taking a look at it in the context of icXML, our
accelerated version of Xerces incorporating Parabix (parallel
bit stream) technology.   Unfortunately, icXML-0.95 also has
the bug.

In essence, I think the problem is that the default processing
of unions in Xerces/icXML is to process them as if they have "collapse"
as the value of the whiteSpace facet.    But this is not in accord with
the XML Schema spec as I read it.

We'll put it on the roadmap for a fix in icXML and we may be able
to submit a patch for Xerces as well.




On Mon, Jan 6, 2014 at 7:02 AM, Glidden, Douglass A <
douglass.a.glid...@boeing.com> wrote:

> 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