All Classes |Grouped Classes |Index

Class CL_DomElement

DOM Element class. More...

Derived from:

public CL_DomNode

Derived by:

None

Group:

XML (Core)

#include <ClanLib/core.h>

Class Members:

Construction:

CL_DomElement

Constructs a DOM Element handle.


Attributes:

get_tag_name

Returns the name of the element.


Operations:

has_attribute

Returns true if the element has the specified attribute.

has_attribute_ns

Returns true if the element has the specified attribute.

get_attribute

Returns the specified attribute.

get_attribute_ns

Returns the specified attribute.

set_attribute

Adds a new attribute.

set_attribute_ns

remove_attribute

Removes an attribute by name.

remove_attribute_ns

get_attribute_node

Get attribute node.

get_attribute_node_ns

set_attribute_node

Set attribute node.

set_attribute_node_ns

Set attribute node ns.

get_elements_by_tag_name

Returns a NodeList of all descendant elements with a given tag name.

get_elements_by_tag_name_ns

get_text

Returns the text of all child Text nodes appended together.

get_child_string

Returns the text value of the child node with the given tag name.

get_child_string_ns

Returns the text value of the child node with the given local name and namespace.

get_child_int

Returns the integer value of the child node with the given tag name.

get_child_int_ns

Returns the integer value of the child node with the given local name and namespace.

get_child_bool

Returns the boolean value of the child node with the given tag name.

get_child_bool_ns

Returns the boolean value of the child node with the given local name and namespace.

set_child_string

Sets the child node with the specified tag name to the given text value.

set_child_string_ns

Sets the child node with the specified qualified name and namespace to the given text value.

set_child_int

Sets the child node with the specified tag name to the given integer value.

set_child_int_ns

Sets the child node with the specified qualified name and namespace to the given integer value.

set_child_bool

Sets the child node with the specified tag name to the given boolean value.

set_child_bool_ns

Sets the child node with the specified qualified name and namespace to the given boolean value.

get_first_child_element

Returns the first child node that is an element node.

get_next_sibling_element

Returns the next sibling node that is an element node.

get_attribute_int

Returns the integer value of the attribute node with the given tag name.

get_attribute_int_ns

Returns the integer value of the attribute node with the given local name and namespace.

get_attribute_bool

Returns the boolean value of the attribute node with the given tag name.

get_attribute_bool_ns

Returns the boolean value of the attribute node with the given local name and namespace.

get_attribute_float

Returns the floating-point value of the attribute node with the given tag name.

get_attribute_float_ns

Returns the floating-point value of the attribute node with the given local name and namespace.

set_attribute_int

Sets the attribute node with the specified tag name to the given integer value.

set_attribute_int_ns

Sets the attribute node with the specified qualified name and namespace to the given integer value.

set_attribute_bool

Sets the attribute node with the specified tag name to the given boolean value.

set_attribute_bool_ns

Sets the attribute node with the specified qualified name and namespace to the given boolean value.

set_attribute_float

Sets the attribute node with the specified tag name to the given floating-point value.

set_attribute_float_ns

Sets the attribute node with the specified qualified name and namespace to the given floating-point value.


Attributes:

get_node_name

Returns the node name.

get_namespace_uri

Returns the namespace URI of this node.

get_prefix

Returns the namespace prefix of the node.

set_prefix

Sets the namespace prefix of the node.

get_local_name

Returns local part of the qualified name of this node.

get_node_value

Returns the node value.

set_node_value

Sets the node value.

get_node_type

Returns the node type (one of those in the NodeType enum).

get_parent_node

Returns the parent of this node.

get_child_nodes

Returns a NodeList that contains all children of this node.

get_first_child

The first child of this node.

get_last_child

The last child of this node.

get_previous_sibling

The node immediately preceding this node.

get_next_sibling

The node immediately following this node.

get_attributes

A NamedNodeMap containing the attributes of this node (if it is an Element) or null otherwise.

get_owner_document

The Document object associated with this node.

is_null

Returns true if this is a null node.

is_element

Returns true if this is an element node.

is_attr

Returns true if this is an attribute node.

is_text

Returns true if this is a text node.

is_cdata_section

Returns true if this is a CDATA section node.

is_entity_reference

Returns true if this is an entity reference node.

is_entity

Returns true if this is an entity node.

is_processing_instruction

Returns true if this is a processing instruction node.

is_comment

Returns true if this is a comment node.

is_document

Returns true if this is a document node.

is_document_type

Returns true if this is a document type node.

is_document_fragment

Returns true if this is a document fragment node.

is_notation

Returns true if this is a notation node.

is_supported

Tests whether the DOM implementation implements a specific feature and that feature is supported by this node.

has_attributes

Returns true if this node (if its an element) has any attributes.

has_child_nodes

Returns true if this node has any children.

NodeType

An integer indicating which type of node this is.


Operations:

operator==

Compare operator.

operator!=

Compare operator.

normalize

Merges any adjacent Text nodes.

insert_before

Inserts the node new_child before the existing child node ref_child.

replace_child

Replaces the child node old_child with new_child in the list of children.

remove_child

Removes the child node indicated by old_child from the list of children, and returns it.

append_child

Adds the node new_child to the end of the list of children of this node.

clone_node

Returns a duplicate of this node, i.e., serves as a generic copy constructor for nodes.

to_element

Returns the Element interface to this node.

to_attr

Returns the Attribute interface to this node.

to_text

Returns the Text interface to this node.

to_cdata_section

Returns the CDATA Section interface to this node.

to_entity_reference

Returns the Entity Reference interface to this node.

to_entity

Returns the Entity interface to this node.

to_processing_instruction

Returns the Processing Instruction interface to this node.

to_comment

Returns the Comment interface to this node.

to_document

Returns the Document interface to this node.

to_document_type

Returns the Document Type interface to this node.

to_document_fragment

Returns the Document Fragment interface to this node.

to_notation

Returns the Notation interface to this node.

named_item

Returns the first child node with the specified node name.

named_item_ns

Retrieves the first child node with the specified namespace URI and local name.

find_namespace_uri

Searches the node tree upwards for the namespace URI of the given qualified name.

find_prefix

Searches the node tree upwards for the prefix name for the namespace URI.

select_nodes

Returns all the nodes matching the specified xpath expression using this node as the context node.

select_node

Returns the first node matching the specified xpath expression using this node as the context node.

select_string

Returns the first node value matching the specified xpath expression using this node as the context node.

select_int

Returns the first node value (as integer) matching the specified xpath expression using this node as the context node.

select_float

Returns the first node value (as float) matching the specified xpath expression using this node as the context node.

select_bool

Returns the first node value (as boolean) matching the specified xpath expression using this node as the context node.

Detailed description:

By far the vast majority of objects (apart from text) that authors encounter when traversing a document are Element nodes. Assume the following XML document:

When represented using DOM, the top node is an Element node for "elementExample", which contains two child Elemodes, one for "subelemeelement1" and one for &quont2&qt;subel1&qel1&qul1&qul1" cochildchild nodesnodes.odes.odes.

Elements may have attributes associated with them; since the Element interface inherits from Node, the generic Node interface method getAttributes may be used to retrieve the set of all attributes for an element. There are methods on the Element interface to retrieve either an Attr object by name or an attribute value by name. In XML, where an attribute value may contain entity references, an Attr object should be retrieved to examine the possibly fairly complex sub-tree representing the attribute value.