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 09:50:27 UTC