[xsd-users] Inconsistency in Qname serialization/parsing

Boris Kolpackov boris at codesynthesis.com
Thu Dec 20 04:18:10 EST 2012


Hi Brice,

Ok, I think I figured it out. There are two issues.

brice salva <salva.brice at gmail.com> writes:

>         <Value>Server</Value>
>
> [...]
>
>   <simpleType name="faultcodeEnum">
>     <restriction base="xs:QName">
>       <enumeration value="env:DataEncodingUnknown" />
>       <enumeration value="env:MustUnderstand" />
>       <enumeration value="env:Receiver" />
>       <enumeration value="env:Sender" />
>       <enumeration value="env:VersionMismatch" />
>     </restriction>
>   </simpleType>
>
> [...]
> 
> xml_schema::Qname(soapEnv::EnvelopeElement::namespace_(),"Server")

Firstly, "Server" doesn't seem to be in the faultcodeEnum enumeration.
Was it supposed to be "Sender"?

The second issue is quite obscure. It boils down to how an unprefixed
QName value is resolved in the context of a default namespace (as in
your case). The choices are to treat it unqualified or to treat it
as qualified with the default namespace. Apparently[1], the original
XML Schema spec does not specify this so an errata was proposed where
the qualified option were to be mandated. However, this errata[2] still
appears to be open, probably because it would break existing schemas.
I also couldn't find anything on this in the new XML Schema 1.1 spec.
So, to put it bluntly, it is a mess, like a lot of things in XML Schema.

Xerces-C++ happens to implements the unqualified option. Also, to me,
this seems like a better choice since you can always "fix" the value
to be qualified by simply using a prefix (not elegant but does the
trick). In contrast, with the qualified interpretation there is no way
to specify an unqualified name in the context of a default namespace.

So in your case, I suggest that you use the "env:" prefix instead of
the default namespace and forget all this as a bad dream ;-).

[1] http://lists.w3.org/Archives/Public/www-xml-schema-comments/2002JulSep/0037.html
[2] http://www.w3.org/2001/05/xmlschema-rec-comments#pfiQName

Boris



More information about the xsd-users mailing list