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

Re: Empty content for Datatypes

From: Martin Duerst <duerst@w3.org>
Date: Thu, 15 Mar 2001 12:03:20 +0900
Message-Id: <>
To: "Jeff Rafter" <jeffrafter@definedweb.com>, "Elena Litani" <hlitani@jtcsv.com>
Cc: <xmlschema-dev@w3.org>

I guess if you don't want to use null, I guess you can
create a union between an integer and a type that only
allows empty.

Regards,   Martin.

At 15:00 01/03/14 -0800, Jeff Rafter wrote:
> > <element name="age" type="positiveInteger"/>
> > Will <age/> or <age></age> in instance XML document be valid?
>No.  These values are not actually "null" wrt to the explicit use of
>xsi:null="true" they simply have empty content and therefore do not match
>the positiveInteger simpleType.
> > Should I declare an element as "nillable" so that empty content is
> > allowed?
>I think you meant "nullable".  Yes this should give you what you want--
>assuming you place the attribute xsi:null="true" in your element.  Though
>there is currently a request for feedback regarding "null".  The only
>wording I could find for this was:
>"If {nullable} is true, then an element may also be valid if it carries the
>namespace qualified attribute with [local name] null from namespace
>http://www.w3.org/2000/10/XMLSchema-instance and value true (see xsi:null
>(ァ2.6.2)) even if it has no text or element content despite a {content type}
>which would otherwise require content. Formal details of element validation
>are described in Element Locally Valid (Element) (ァ3.3)."
>So even with 'nullable="true"' the following is true:
><age/> = invalid
><age></age> = invalid
><age xsi:null="true"/> = valid
><age xsi:null="true"></age> = valid
><age xsi:null="true">10</age> = invalid
><age>10</age> = valid
>Good luck,
>Jeff Rafter
>Defined Systems
Received on Wednesday, 14 March 2001 22:47:05 UTC

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