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

Re: xsi:type Usage

From: C. M. Sperberg-McQueen <cmsmcq@acm.org>
Date: 07 Dec 2005 18:56:29 -0700
To: Tobin M Clough <tclough@us.ibm.com>
Cc: W3C XML Schema Comments list <www-xml-schema-comments@w3.org>, xmlschemaTSfaq@nist.gov
Message-Id: <1134006968.7844.256.camel@localhost>

On Mon, 2005-12-05 at 15:33, Tobin M Clough wrote:

> Hello,

> I think this is a very simple question, but I can't seem to find any
> documentation on it.  Is this a legal application of the xsi:type
> construct?:

> <isOkay xsi:type="xsd:boolean"/>

> With validation turned off, it seems like this would be a reasonable
> representation of no value (null) for a data item that is either
> true, false, or empty.

If there is no schema, or if 'isOkay' is declared with type
xsd:anyType, xsd:anySimpleType (or, in XML Schema 1.1,
xsd:anyAtomicType), then it's certainly legal to supply an xsi:type
attribute with the value xsd:boolean (assuming that xsd is properly
bound as a namespace prefix in this context).

On the other hand, since the empty string is not a member of the
lexical space of xsd:boolean, the 'isOkay' element shown above will
not be valid. 

If the element 'isOkay' is declared nillable, then

  <isOkay xsi:type="xsd:boolean" xsi:nil="true"/> 

would be valid.  But I believe you are talking about using xsi:type
with undeclared elements; for those, empty elements will be valid only
when the empty string is a member of the relevant lexical space.

Hmm.  I notice that you talk about using this "with validation turned
off".  Under those circumstances, of course, it hardly matters whether
the element would be valid or not if it *were* validated. 

I hope this helps.

-C. M. Sperberg-McQueen
 World Wide Web Consortium
Received on Thursday, 8 December 2005 01:59:11 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Sunday, 6 December 2009 18:13:10 GMT