Re: Question about strings...

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