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

Re: value of a NULL element

From: Morris Matsa <mmatsa@us.ibm.com>
Date: Wed, 5 Dec 2001 12:01:02 -0500
To: Jeni Tennison <jeni@jenitennison.com>
Cc: "maddy pawar" <madhuvanti@hotmail.com>, xmlschema-dev@w3.org
Message-ID: <OF62906F3D.8505150D-ON85256B19.005CB017@pok.ibm.com>


> value of an empty string; if you've declared it as being as type
> decimal it's not a valid element (because it doesn't have a number as
> its value) - its lexical value is an empty string.

Is the empty string a legal decimal value?  I know several people have
asked and I can't remember the answer to this anymore,  but "0" is
legal, and "Leading and trailing zeroes are optional." [1] so I can
see the spec allowing it.  Would nil-ed out decimal elements then be
of value '0' or the default value if one is given?



Jeni Tennison <jeni@jenitennison.com>@w3.org on 12/05/2001 08:14:54 AM

Please respond to Jeni Tennison <jeni@jenitennison.com>

Sent by:  xmlschema-dev-request@w3.org


To:   "maddy pawar" <madhuvanti@hotmail.com>
cc:   xmlschema-dev@w3.org
Subject:  Re: value of a NULL element



Hi Maddy,

> If i try to obtain the contents of an empty element, what is the
> return value i should expect? Is is "NULL"?

It depends on what you're using to obtain the contents of the empty
element. If you have:

  <foo />

then in XPath, the foo element has no child nodes and has a string
value of ''. In DOM, the foo element has no child nodes.

As far as an XML Schema validator is concerned the foo element has no
content and if you've declared it as being of type string it has the
value of an empty string; if you've declared it as being as type
decimal it's not a valid element (because it doesn't have a number as
its value) - its lexical value is an empty string.

If you have:

  <foo xsi:nil="true" />

Then the value of the foo element is the same as above, but it is
also labelled as being a nil value.

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/
Received on Wednesday, 5 December 2001 12:01:14 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:25 GMT