[xsd-users] Inconsistency in Qname serialization/parsing

brice salva salva.brice at gmail.com
Mon Dec 31 07:52:01 EST 2012


Hi Boris,

Many thanks for this complete clarification.
As for the first point, indeed, it is a typo. Actually, my xml input file
contains "Sender" and not "Server".
Regarding the second point, I agree with you : using the "env:" prefix is
the best and simplest workaround for now.
Yet, with xsd codesynthesis, I cannot customize the default namespace
prefix when I use the *element-type* and *element-map* parse/serialize
methods to exchange xml messages (no properties as parameter).
Is there any trick to do such a thing ?

Once more, thanks.
Brice


On Thu, Dec 20, 2012 at 10:18 AM, Boris Kolpackov
<boris at codesynthesis.com>wrote:

> 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