1.2 Basic Types
Basic Types
To ensure interoperability, this specification specifies the following
basic types used in various DOM modules. Even though the DOM
uses the basic types in the interfaces, bindings may use
different types and normative bindings are only given for Java and
ECMAScript in this specification.
The DOMString Type[top]
The DOMString Type
The DOMString type is used to store [Unicode] characters as a sequence of 16-bit units using UTF-16 as
defined in [Unicode] and Amendment 1 of [ISO10646].
Characters are fully
normalized as defined in appendix B of [XML11] if:
-
the parameter "normalize-characters"
was set to true while loading the document or
the document was certified as defined in [XML11];
-
the parameter "normalize-characters"
was set to true while using the method
Document.normalizeDocument(), or while using
the method Node.normalize();
Note that, with the exceptions of
Document.normalizeDocument() and
Node.normalize(), manipulating characters using DOM
methods does not guarantee to preserve a
fully-normalized text.
A DOMString is a sequence of
16-bit units.
The UTF-16 encoding was chosen because of its widespread industry
practice. Note that for both HTML and XML, the document character set
(and therefore the notation of numeric character references) is based on
UCS [ISO10646]. A single numeric character reference in a
source document may therefore in some cases correspond to two 16-bit
units in a DOMString (a high surrogate and a low
surrogate). For issues related to string comparisons, refer to
[String Comparisons in the DOM].
For Java and ECMAScript, DOMString is bound to the
String type because both languages also use UTF-16
as their encoding.
NOTE:
As of August 2000, the OMG IDL specification
([OMGIDL]) included a wstring
type. However, that definition did not meet the interoperability
criteria of the DOM API since it
relied on negotiation to decide the width and encoding of a
character.
The DOMTimeStamp Type[top]
The DOMTimeStamp Type
The DOMTimeStamp type is used to store an absolute
or relative time.
A DOMTimeStamp represents a number of
milliseconds.
unsigned long long
For Java, DOMTimeStamp is bound to the
long type. For ECMAScript, DOMTimeStamp
is bound to the Date type because the range of the
integer type is too small.
The DOMUserData Type[top]
The DOMUserData Type
The DOMUserData type is used to store
application data.
A DOMUserData represents a reference to
application data.
any
For Java, DOMUserData is bound to the
Object type. For ECMAScript,
DOMUserData is bound to any type.
The DOMObject Type[top]
The DOMObject Type
The DOMObject type is used to represent an
object.
A DOMObject represents an object reference.
Object
For Java and ECMAScript, DOMObject is bound to the
Object type.
|