Re: value of a NULL element

> 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 UTC