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

namespaces for xs:QName values

From: Jeni Tennison <jeni@jenitennison.com>
Date: Sat, 24 Nov 2001 15:40:50 +0000
Message-ID: <16013382322.20011124154050@jenitennison.com>
To: www-xml-schema-comments@w3.org

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-[:]]*" />

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-[:]]*" />

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" />

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" />


Jeni Tennison
Received on Sunday, 25 November 2001 09:33:28 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 14:49:57 UTC