W3C home > Mailing lists > Public > www-xml-schema-comments@w3.org > October to December 2001

Re: namespaces for xs:QName values

From: Martin Gudgin <marting@develop.com>
Date: Sun, 25 Nov 2001 22:17:18 -0000
Message-ID: <001c01c175fe$f37a5c30$807ba8c0@greyarea>
To: "Jeni Tennison" <jeni@jenitennison.com>, <www-xml-schema-comments@w3.org>
You are correct that there is no way to say 'this QName derived type can
have any local name provided the namespace URI is XXXX'. As such the
namespace facet you suggest would be useful in this regard.

What wasn't clear to me from your note was whether you were also saying that
it is impossible to define prefix independent QName derived types. You can
certainly define QName derived types that are not prefix dependant;

<xs:simpleType name='foo' xmlns:xs='http://www.w3.org/2001/XMLSchema'
                          xmlns:p='urn:example-org:stuff' >
  <xs:restriction base='xs:QName' >
    <xs:enumeration value='p:bar' />
    <xs:enumeration value='p:baz' />
    <xs:enumeration value='p:quux' />
  </xs:restriction>
</xs:simpleType>

Such a type specifies the namespace names and local names that are valid for
this type without restricting the prefix used in the instance document.

Regards

Martin Gudgin
DevelopMentor

----- Original Message -----
From: "Jeni Tennison" <jeni@jenitennison.com>
To: <www-xml-schema-comments@w3.org>
Sent: Saturday, November 24, 2001 3:40 PM
Subject: namespaces for xs:QName values


> Hi,
>
> I'd like to suggest adding a namespace facet to XML Schema Datatypes,
> used when restricting xs:QName values.
>
> Currently, you can restrict QNames using a pattern to say that they
> have to have a prefix, for example, with something like:
>
> <xs:simpleType name="prefixedQName">
>   <xs:restriction base="xs:QName">
>     <xs:pattern value="[\i-[:]][\c-[:]]*:[\i-[:]][\c-[:]]*" />
>   </xs:restriction>
> </xs:simpleType>
>
> You can also make sure that the prefix is some pre-defined prefix,
> for example 'xs', with:
>
> <xs:simpleType name="prefixedQName">
>   <xs:restriction base="xs:QName">
>     <xs:pattern value="xs:[\i-[:]][\c-[:]]*" />
>   </xs:restriction>
> </xs:simpleType>
>
> But you can't say that the QName has to come from the XML Schema
> namespace, but you don't care what prefix is associated with that
> namespace. I think it would be handy to be able to do that with a
> namespace facet:
>
> <xs:simpleType name="prefixedQName">
>   <xs:restriction base="xs:QName">
>     <xs:namespace value="http://www.w3.org/2001/XMLSchema" />
>   </xs:restriction>
> </xs:simpleType>
>
> This could take special values such as ##targetNamespace, ##local or
> ##other, like the namespace attribute on wildcards. Multiple
> xs:namespace elements would give alternative namespaces.
>
> For example, the XML Events ev:event attribute takes a QName, which
> can be one of several fixed values or something outside the XML Events
> namespace. Assuming ev is associated with the XML Events namespace,
> and that namespace is the target namespace of the schema, it would be
> possible to articulate this in an XML Events schema with:
>
>   <xs:restriction base="xs:QName">
>     <xs:enumeration value="ev:focusIn" />
>     <xs:enumeration value="ev:focusOut" />
>     ...
>     <xs:namespace value="##other" />
>   </xs:restriction>
>
> Cheers,
>
> Jeni
> ---
> Jeni Tennison
> http://www.jenitennison.com/
>
>
Received on Sunday, 25 November 2001 17:18:12 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Sunday, 6 December 2009 18:12:57 GMT