W3C home > Mailing lists > Public > xmlschema-dev@w3.org > July 2002

Re: Question about strings...

From: Jeni Tennison <jeni@jenitennison.com>
Date: Wed, 31 Jul 2002 10:23:21 +0100
Message-ID: <115-2143452602.20020731102321@jenitennison.com>
To: xmlschema-dev@w3.org, Brenda Bell <bbell@juicesoftware.com>

Hi Brenda,

> As best as I can tell from the schema spec, there aren't any
> restrictions on the minLength facet for strings other than the fact
> that it must be a nonNegativeInteger. If I declare a string where
> minLength is 0, should a schema-aware parser accept the following
> element in an instance document:
>
>     <name xsi:type="xsd:string"/>

Yes, a schema validator should accept this provided that the name
element has been declared as having the type xs:string,
xs:anySimpleType or xs:anyType. But if you'd declared the name element
as:

<xs:element name="name">
  <xs:simpleType>
    <xs:restriction base="xs:string">
      <xs:minLength value="0" />
    </xs:restriction>
  </xs:simpleType>
</xs:element>

then the above shouldn't be accepted, not because of anything to do
with the minLength facet, but simply because when you use xsi:type it
must specify a type that's derived from (or the same as) the type
declared for the element.

(I suspect that you know this, just wanted to make it clear since your
question was a little ambiguous.)

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/
Received on Wednesday, 31 July 2002 05:23:22 UTC

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