RadControls for WinForms

Classes

  ClassDescription
Public classDomException
DOM operations only raise exceptions in "exceptional" circumstances, i.e., when an operation is impossible to perform (either for logical reasons, because data is lost, or because the implementation has become unstable). In general, DOM methods return specific error values in ordinary processing situations, such as out-of-bound errors when using
CopyC#
NodeList
.

Implementations should raise other exceptions under other circumstances. For example, implementations should raise an implementation-dependent exception if a

CopyC#
null
argument is passed.

Some languages and object systems do not support the concept of exceptions. For such systems, error conditions may be indicated using native error reporting mechanisms. For some bindings, for example, methods may return error codes similar to those listed in the corresponding method descriptions.

See also the Document Object Model (DOM) Level 2 Core Specification.

Interfaces

  InterfaceDescription
Public interfaceIAttr
The
CopyC#
Attr
interface represents an attribute in an
CopyC#
Element
object. Typically the allowable values for the attribute are defined in a document type definition.

CopyC#
Attr
objects inherit the
CopyC#
Node
interface, but since they are not actually child nodes of the element they describe, the DOM does not consider them part of the document tree. Thus, the
CopyC#
Node
attributes
CopyC#
parentNode
,
CopyC#
previousSibling
, and
CopyC#
nextSibling
have a
CopyC#
null
value for
CopyC#
Attr
objects. The DOM takes the view that attributes are properties of elements rather than having a separate identity from the elements they are associated with; this should make it more efficient to implement such features as default attributes associated with all elements of a given type. Furthermore,
CopyC#
Attr
nodes may not be immediate children of a
CopyC#
DocumentFragment
. However, they can be associated with
CopyC#
Element
nodes contained within a
CopyC#
DocumentFragment
. In short, users and implementors of the DOM need to be aware that
CopyC#
Attr
nodes have some things in common with other objects inheriting the
CopyC#
Node
interface, but they also are quite distinct.

The attribute's effective value is determined as follows: if this attribute has been explicitly assigned any value, that value is the attribute's effective value; otherwise, if there is a declaration for this attribute, and that declaration includes a default value, then that default value is the attribute's effective value; otherwise, the attribute does not exist on this element in the structure model until it has been explicitly added. Note that the

CopyC#
nodeValue
attribute on the
CopyC#
Attr
instance can also be used to retrieve the string version of the attribute's value(s).

In XML, where the value of an attribute can contain entity references, the child nodes of the

CopyC#
Attr
node may be either
CopyC#
Text
or
CopyC#
EntityReference
nodes (when these are in use; see the description of
CopyC#
EntityReference
for discussion). Because the DOM Core is not aware of attribute types, it treats all attribute values as simple strings, even if the DTD or schema declares them as having tokenized types.

See also the Document Object Model (DOM) Level 2 Core Specification.

Public interfaceICdataSection
CDATA sections are used to escape blocks of text containing characters that would otherwise be regarded as markup. The only delimiter that is recognized in a CDATA section is the "]]>" string that ends the CDATA section. CDATA sections cannot be nested. Their primary purpose is for including material such as XML fragments, without needing to escape all the delimiters.

The

CopyC#
DOMString
attribute of the
CopyC#
Text
node holds the text that is contained by the CDATA section. Note that this may contain characters that need to be escaped outside of CDATA sections and that, depending on the character encoding ("charset") chosen for serialization, it may be impossible to write out some characters as part of a CDATA section.

The

CopyC#
CDATASection
interface inherits from the
CopyC#
CharacterData
interface through the
CopyC#
Text
interface. Adjacent
CopyC#
CDATASection
nodes are not merged by use of the
CopyC#
normalize
method of the
CopyC#
Node
interface. Because no markup is recognized within a
CopyC#
CDATASection
, character numeric references cannot be used as an escape mechanism when serializing. Therefore, action needs to be taken when serializing a
CopyC#
CDATASection
with a character encoding where some of the contained characters cannot be represented. Failure to do so would not produce well-formed XML.One potential solution in the serialization process is to end the CDATA section before the character, output the character using a character reference or entity reference, and open a new CDATA section for any further characters in the text node. Note, however, that some code conversion libraries at the time of writing do not return an error or exception when a character is missing from the encoding, making the task of ensuring that data is not corrupted on serialization more difficult.

See also the Document Object Model (DOM) Level 2 Core Specification.

Public interfaceICharacterData
The
CopyC#
CharacterData
interface extends Node with a set of attributes and methods for accessing character data in the DOM. For clarity this set is defined here rather than on each object that uses these attributes and methods. No DOM objects correspond directly to
CopyC#
CharacterData
, though
CopyC#
Text
and others do inherit the interface from it. All
CopyC#
offsets
in this interface start from
CopyC#
0
.

As explained in the

CopyC#
DOMString
interface, text strings in the DOM are represented in UTF-16, i.e. as a sequence of 16-bit units. In the following, the term 16-bit units is used whenever necessary to indicate that indexing on CharacterData is done in 16-bit units.

See also the Document Object Model (DOM) Level 2 Core Specification.

Public interfaceIComment
This interface inherits from
CopyC#
CharacterData
and represents the content of a comment, i.e., all the characters between the starting '
CopyC#
<!--
' and ending '
CopyC#
-->
'. Note that this is the definition of a comment in XML, and, in practice, HTML, although some HTML tools may implement the full SGML comment structure.

See also the Document Object Model (DOM) Level 2 Core Specification.

Public interfaceIDocument
The
CopyC#
Document
interface represents the entire HTML or XML document. Conceptually, it is the root of the document tree, and provides the primary access to the document's data.

Since elements, text nodes, comments, processing instructions, etc. cannot exist outside the context of a

CopyC#
Document
, the
CopyC#
Document
interface also contains the factory methods needed to create these objects. The
CopyC#
Node
objects created have a
CopyC#
ownerDocument
attribute which associates them with the
CopyC#
Document
within whose context they were created.

See also the Document Object Model (DOM) Level 2 Core Specification.

Public interfaceIDocumentFragment
CopyC#
DocumentFragment
is a "lightweight" or "minimal"
CopyC#
Document
object. It is very common to want to be able to extract a portion of a document's tree or to create a new fragment of a document. Imagine implementing a user command like cut or rearranging a document by moving fragments around. It is desirable to have an object which can hold such fragments and it is quite natural to use a Node for this purpose. While it is true that a
CopyC#
Document
object could fulfill this role, a
CopyC#
Document
object can potentially be a heavyweight object, depending on the underlying implementation. What is really needed for this is a very lightweight object.
CopyC#
DocumentFragment
is such an object.

Furthermore, various operations -- such as inserting nodes as children of another

CopyC#
Node
-- may take
CopyC#
DocumentFragment
objects as arguments; this results in all the child nodes of the
CopyC#
DocumentFragment
being moved to the child list of this node.

The children of a

CopyC#
DocumentFragment
node are zero or more nodes representing the tops of any sub-trees defining the structure of the document.
CopyC#
DocumentFragment
nodes do not need to be well-formed XML documents (although they do need to follow the rules imposed upon well-formed XML parsed entities, which can have multiple top nodes). For example, a
CopyC#
DocumentFragment
might have only one child and that child node could be a
CopyC#
Text
node. Such a structure model represents neither an HTML document nor a well-formed XML document.

When a

CopyC#
DocumentFragment
is inserted into a
CopyC#
Document
(or indeed any other
CopyC#
Node
that may take children) the children of the
CopyC#
DocumentFragment
and not the
CopyC#
DocumentFragment
itself are inserted into the
CopyC#
Node
. This makes the
CopyC#
DocumentFragment
very useful when the user wishes to create nodes that are siblings; the
CopyC#
DocumentFragment
acts as the parent of these nodes so that the user can use the standard methods from the
CopyC#
Node
interface, such as
CopyC#
insertBefore
and
CopyC#
appendChild
.

See also the Document Object Model (DOM) Level 2 Core Specification.

Public interfaceIDocumentType
Each
CopyC#
Document
has a
CopyC#
doctype
attribute whose value is either
CopyC#
null
or a
CopyC#
DocumentType
object. The
CopyC#
DocumentType
interface in the DOM Core provides an interface to the list of entities that are defined for the document, and little else because the effect of namespaces and the various XML schema efforts on DTD representation are not clearly understood as of this writing.

The DOM Level 2 doesn't support editing

CopyC#
DocumentType
nodes.

See also the Document Object Model (DOM) Level 2 Core Specification.

Public interfaceIDomImplementation
The
CopyC#
DOMImplementation
interface provides a number of methods for performing operations that are independent of any particular instance of the document object model.

See also the Document Object Model (DOM) Level 2 Core Specification.

Public interfaceIElement
The
CopyC#
Element
interface represents an element in an HTML or XML document. Elements may have attributes associated with them; since the
CopyC#
Element
interface inherits from
CopyC#
Node
, the generic
CopyC#
Node
interface attribute
CopyC#
attributes
may be used to retrieve the set of all attributes for an element. There are methods on the
CopyC#
Element
interface to retrieve either an
CopyC#
Attr
object by name or an attribute value by name. In XML, where an attribute value may contain entity references, an
CopyC#
Attr
object should be retrieved to examine the possibly fairly complex sub-tree representing the attribute value. On the other hand, in HTML, where all attributes have simple string values, methods to directly access an attribute value can safely be used as a convenience.In DOM Level 2, the method
CopyC#
normalize
is inherited from the
CopyC#
Node
interface where it was moved.

See also the Document Object Model (DOM) Level 2 Core Specification.

Public interfaceIEntityReference
CopyC#
EntityReference
objects may be inserted into the structure model when an entity reference is in the source document, or when the user wishes to insert an entity reference. Note that character references and references to predefined entities are considered to be expanded by the HTML or XML processor so that characters are represented by their Unicode equivalent rather than by an entity reference. Moreover, the XML processor may completely expand references to entities while building the structure model, instead of providing
CopyC#
EntityReference
objects. If it does provide such objects, then for a given
CopyC#
EntityReference
node, it may be that there is no
CopyC#
Entity
node representing the referenced entity. If such an
CopyC#
Entity
exists, then the subtree of the
CopyC#
EntityReference
node is in general a copy of the
CopyC#
Entity
node subtree. However, this may not be true when an entity contains an unbound namespace prefix. In such a case, because the namespace prefix resolution depends on where the entity reference is, the descendants of the
CopyC#
EntityReference
node may be bound to different namespace URIs.

As for

CopyC#
Entity
nodes,
CopyC#
EntityReference
nodes and all their descendants are readonly.

See also the Document Object Model (DOM) Level 2 Core Specification.

Public interfaceINamedNodeMap
Objects implementing the
CopyC#
NamedNodeMap
interface are used to represent collections of nodes that can be accessed by name. Note that
CopyC#
NamedNodeMap
does not inherit from
CopyC#
NodeList
;
CopyC#
NamedNodeMaps
are not maintained in any particular order. Objects contained in an object implementing
CopyC#
NamedNodeMap
may also be accessed by an ordinal index, but this is simply to allow convenient enumeration of the contents of a
CopyC#
NamedNodeMap
, and does not imply that the DOM specifies an order to these Nodes.

CopyC#
NamedNodeMap
objects in the DOM are live.

See also the Document Object Model (DOM) Level 2 Core Specification.

Public interfaceINode
The
CopyC#
Node
interface is the primary datatype for the entire Document Object Model. It represents a single node in the document tree. While all objects implementing the
CopyC#
Node
interface expose methods for dealing with children, not all objects implementing the
CopyC#
Node
interface may have children. For example,
CopyC#
Text
nodes may not have children, and adding children to such nodes results in a
CopyC#
DOMException
being raised.

The attributes

CopyC#
nodeName
,
CopyC#
nodeValue
and
CopyC#
attributes
are included as a mechanism to get at node information without casting down to the specific derived interface. In cases where there is no obvious mapping of these attributes for a specific
CopyC#
nodeType
(e.g.,
CopyC#
nodeValue
for an
CopyC#
Element
or
CopyC#
attributes
for a
CopyC#
Comment
), this returns
CopyC#
null
. Note that the specialized interfaces may contain additional and more convenient mechanisms to get and set the relevant information.

See also the Document Object Model (DOM) Level 2 Core Specification.

Public interfaceINodeList
The
CopyC#
NodeList
interface provides the abstraction of an ordered collection of nodes, without defining or constraining how this collection is implemented.
CopyC#
NodeList
objects in the DOM are live.

The items in the

CopyC#
NodeList
are accessible via an integral index, starting from 0.

See also the Document Object Model (DOM) Level 2 Core Specification.

Public interfaceIProcessingInstruction
The
CopyC#
ProcessingInstruction
interface represents a "processing instruction", used in XML as a way to keep processor-specific information in the text of the document.

See also the Document Object Model (DOM) Level 2 Core Specification.

Public interfaceIText
The
CopyC#
Text
interface inherits from
CopyC#
CharacterData
and represents the textual content (termed character data in XML) of an
CopyC#
Element
or
CopyC#
Attr
. If there is no markup inside an element's content, the text is contained in a single object implementing the
CopyC#
Text
interface that is the only child of the element. If there is markup, it is parsed into the information items (elements, comments, etc.) and
CopyC#
Text
nodes that form the list of children of the element.

When a document is first made available via the DOM, there is only one

CopyC#
Text
node for each block of text. Users may create adjacent
CopyC#
Text
nodes that represent the contents of a given element without any intervening markup, but should be aware that there is no way to represent the separations between these nodes in XML or HTML, so they will not (in general) persist between DOM editing sessions. The
CopyC#
normalize()
method on
CopyC#
Node
merges any such adjacent
CopyC#
Text
objects into a single node for each block of text.

See also the Document Object Model (DOM) Level 2 Core Specification.

Enumerations

  EnumerationDescription
Public enumerationNodeType