Base node class.
Base node class.
AnewtXMLDomNode instances cannot be instantiated directly, since this class only serve as a base class for e.g. AnewtXMLDomElement and AnewtXMLDomText.
: Implement first_child, last_child, previous_sibling and next_sibling attributes in node trees.
static create_for_value($value) [static] ¶Create a new DOM node for any value.
This method converts any value into a AnewtXMLDomNode instance (or subclass thereof). If the value is a renderer object, it is rendered. If the renderer object renders an AnewtXMLDomNode itself, it is used, else the rendered value is converted to a text node (which takes care of escaping).
$valueThe value to convert
An AnewtXMLDomNode instance (or subclass).
__construct() ¶Construct and initialise a new node instance.
is_same_node($other_node) ¶Returns whether this node is the same node as the given one.
$other_nodeA AnewtXMLDomNode instance to test against.
Returns true if the nodes are the same, false otherwise.
append_child($new_child) ¶Adds the node $new_child to the end of the list of children of this node.
The node may not be attached elsewhere in the tree already.
$new_childThe node to add.
The node added.
append_children(&$new_children) ¶Recursively appends children to this element.
Strings are converted into text nodes. This method expands numerical arrays and ignores null values.
$new_childrenArray of children elements
& remove_child(&$old_child) ¶Removes the child node from the list of children, and returns it.
$old_childThe node being removed.
The node removed.
& replace_child(&$new_child, &$old_child) ¶Replaces a child node with a new child, and returns the old child node.
This method is not implemented yet.
$new_childThe new node to put in the child list.
$old_childThe node being replaced in the list.
The node replaced.
& insert_before(&$new_child, &$ref_child) ¶Inserts the node $new_child before the existing child node $ref_child.
If $ref_child is null, insert $new_child at the end of the list of children.
This method is not implemented yet.
$new_childThe node to insert.
$ref_childThe reference node, i.e., the node before which the new node must be inserted.
The node being inserted.
has_child_nodes() ¶Returns whether this node has any children.
Returns true if this node has any children, false otherwise.
$node_name ¶The name of this node, depending on its type.
$owner_document ¶The AnewtXMLDomDocument object associated with this node.
$child_nodes ¶List of child nodes.
$parent_node ¶The parent of this node.
$_attributes [protected] ¶Hash of all attributes.
$allowed_attributes [protected] ¶List of allowed attributes.
$must_be_empty [protected] ¶Whether this node can contain children.
$allowed_elements [protected] ¶List of allowed child element names.
$allows_text [protected] ¶Whether this node can have text content.
$__object_id [private] ¶Used for identity checking.