W3C home > Mailing lists > Public > www-dom@w3.org > July to September 2000

Re: Usage of null

From: Kim Adamson-Sharpe <kim@sqwest.bc.ca>
Date: Mon, 18 Sep 2000 12:54:26 -0700
Message-Id: <>
To: "Martin v. Loewis" <martin@loewis.home.cs.tu-berlin.de>, www-dom@w3c.org
Hi Martin,

Do you mean that something like this from the Node interface:

         attribute DOMString nodeValue; // may be null

is a problem?


At 01:33 PM 9/17/00 Sunday, Martin v. Loewis wrote:
>In the DOM spec, many attributes are allowed to have a special value
>'null', in addition to their normal values. This is an extension to
>normal OMG IDL, where values normally cannot be null. Many programming
>languages cannot properly represent
>    readonly attribute long foo; // may be null
>An object possessing the attribute foo typically can have only
>integral numbers as values; the additional null value is not supported
>eg. in C, C++, or Java. It *is* supported in languages where numbers
>are objects (e.g. Python).
>The only exception in CORBA are object references: Attributes of a
>reference type may be null. Specifically, strings, or sequences,
>cannot be null.
>CORBA 2.3 adds the valuetype construct, which allows to wrap an object
>around any value (called valuebox); this gives a null value to any
>type. A string that may be null can be defined as
>   valuetype DOMString sequence<unsigned short>;
>In this type, the empty sequence (with zero elements) is different
>from the null sequence.
>I'd recommend that the DOM is carefully reviewed with that respect,
>and as many occurences of null values are eliminated, possibly
>suggesting use of empty strings instead.
>For the remaining places, you may find that they are null objects,
>which would be fine. Otherwise, the DOM should explicitly state the
>intent behind null values, and leaving it up to the target language to
>deal with it. Alternatively, value boxes may be used to indicate that
>a specific type includes null.
>If null values are allowed for string attributes, it should be stated
>explicitly in which cases empty strings and in which cases null
>strings are acceptable.

Kim Adamson-Sharpe <kim@softquad.com> phone: 604-585-8394 ext. 311
Sr. Software Developer, SoftQuad Software Inc., http://www.softquad.com/
Received on Monday, 18 September 2000 15:56:56 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 20 October 2015 10:46:07 UTC