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 09:33:28 UTC