Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


RE: Referencing attributes from the XMLSchema-instance namespace

From: "Michael Kay" <mike@--------.--->
To: "'Boris Kolpackov'" <boris@-------------.--->, <xmlschema-dev@--.--->
Date: 3/1/2007 5:25:00 PM
See section 3.2.6 of Schema Part 1:

<quote>
Schema Component Constraint: xsi: Not Allowed

The {target namespace} of an attribute declaration, whether local or
top-level, must not match http://www.w3.org/2001/XMLSchema-instance (unless
it is one of the four built-in declarations given in the next section).

Note: This reinforces the special status of these attributes, so that they
not only need not be declared to be allowed in instances, but must not be
declared. It also removes any temptation to experiment with supplying global
or fixed values for e.g. xsi:type or xsi:nil, which would be seriously
misleading, as they would have no effect.
</quote>

However, you haven't declared the xsi:type attribute, you have only
referenced the declaration. I can't see anything that makes that illegal. It
also seems legal to "experiment with supplying a fixed value" for xsi:type,
since you can do that on the attribute use, it doesn't have to be on the
declaration; and I can't find the rule that says that doing so would have no
effect. (Though it's rather circular: you don't know whether xsi:type is
constrained until you know what complex type you are validating against, and
you don't know that until you have validated xsi:type.)

That leaves the question of whether you can reference the declaration as in
your example. The specification states that the attribute declaration for
xsi:type is present in every schema "by definition", but there's a question
mark about whether you need to import the namespace before you can refer to
it. (The spec for xs:import says that it enables you to refer to components
in a different namespace, but it doesn't actually say that it's an error to
refer to components in a different namespace without importing it.) Next
question is, if you do an import, without specifying a schema location, can
that import fail?

All very interesting: yet another can of worms, I suspect. My suspicion is
that the WG intended to make ref="xsi:type" illegal but got the words wrong.
It wouldn't be the first time.

Michael Kay
http://www.saxonica.com/"

 

> -----Original Message-----
> From: xmlschema-dev-request@w... 
> [mailto:xmlschema-dev-request@w...] On Behalf Of Boris Kolpackov
> Sent: 01 March 2007 16:28
> To: xmlschema-dev@w...
> Cc: Dwight Kelly
> Subject: Referencing attributes from the XMLSchema-instance namespace
> 
> Hi,
> 
> Microsof's Print Schema[1] has a fragment that looks like so:
> 
> 
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
>            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
> 
>   <xs:complexType name="Type" mixed="true">
>     <xs:attribute ref="xsi:type" use="required"/>
>   </xs:complexType>
> 
> <xs:schema>
> 
> 
> There is no import declaration for the xsi namespace. I am 
> wondering whether this is legal or not. I can see three 
> possible answers actually: (1) this schema is valid, (2) this 
> schema is invalid but can be made valid by importing a schema 
> that declares xsi:type:
> 
> 
> <schema targetNamespace="http://www.w3.org/2001/XMLSchema-instance"
>         xmlns="http://www.w3.org/2001/XMLSchema"
>         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
> 
> <attribute name="type" type="xs:QName"/> <attribute 
> name="nil" type="xs:boolean"/>
> 
> </schema>
> 
> 
> And, finally, (3) referencing attributes from the xsi 
> namespace in the definition is illegal.
> 
> 
> [1] http://www.microsoft.com/whdc/xps/printschema.mspx
> 
> 
> thanks,
> -boris
> 
> 
> --
> Boris Kolpackov
> Code Synthesis Tools CC
> http://www.codesynthesis.com
> Open-Source, Cross-Platform C++ XML Data Binding
> 


From mike@s... Thu Mar 01 17:33:20 2007
Received: from maggie.w3.org ([193.51.208.68])
	by frink.w3.org with esmtp (Exim 4.50)
	id 1


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent