W3C home > Mailing lists > Public > xmlschema-dev@w3.org > December 2001

Simple Type Questions

From: <sandygao@ca.ibm.com>
Date: Mon, 3 Dec 2001 14:04:18 -0500
To: www-xml-schema-comments@w3.org, xmlschema-dev@w3.org
Message-ID: <OF39FE3080.59F1FD13-ON85256B17.0067D1CB@torolab.ibm.com>
Hi all,

I got two questions about the datatype spec. I don't know whether these
issues have been raised before. If they have, please accept my apology.

1. What's the canonical representation of QName

The string representation of a QName is in the form "prefix:localpart" (or
"localpart"), and the value of a QName is a tuple {namespace, localpart}.
To convert a QName value to its canonical representation, we have to
"invent" a prefix, which seems not possible to me.

A case where the above problem occurs is: if a default/fixed
attribute/element value is of type QName, how do we apply it to the
instance? For example,

<attribute name="att" type="QName" xmlns:p1="my_uri" default="p1:local"/>

If the above attribute doesn't appear in an instance, we should add a new
attribute. But what'd be the (string) value of the added attribute? (Note
that the prefix "p1" might not be declared in the instance, or it's
possible to be bound to a different namespace uri.)

2. "length" facet for "NMTOKENS", "IDREFS", and "ENTITIES"

According to the spec (schema for schemas), the above types are defined as
a restriction of another list type, by specifying a "minLength" facet. Then
for the following simple type:

<simpleType name="mylist">
  <restriction base="NMTOKENS">
    <length value="3"/>

It would be invalid according to the constraint "Schema Component
Constraint: length and minLength or maxLength". Is this what's intended? If
so, it'd be very inconvenient: the user has to specify both minLength and
maxLength to the same value to achieve the result.

To solve this problem,
a. Don't include a "minLength" facet in the above 3 types. But this means
empty lists are allowed by these types (which might not be proper); or
b. Allow "length" to be specified even if "min/maxLength" are specified on
the base type, as long as
  base.minLength <= length <= base.maxLength.

Sandy Gao
Software Developer, IBM Canada
(1-905) 413-3255
Received on Monday, 3 December 2001 14:04:23 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 23:14:56 UTC