AnewtXMLDomNode Class Reference

Base node class. More...

List of all members.

Public Member Functions

 __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.
 append_child ($new_child)
 Adds the node $new_child to the end of the list of children of this node.
 append_children (&$new_children)
 Recursively appends children to this element.
remove_child (&$old_child)
 Removes the child node from the list of children, and returns it.
replace_child (&$new_child, &$old_child)
 Replaces a child node with a new child, and returns the old child node.
insert_before (&$new_child, &$ref_child)
 Inserts the node $new_child before the existing child node $ref_child.
 has_child_nodes ()
 Returns whether this node has any children.

Static Public Member Functions

static create_for_value ($value)
 Create a new DOM node for any value.

Public Attributes

 $node_type = null
 The node type.
 $node_name = null
 The name of this node, depending on its type.
 $owner_document = null
 The AnewtXMLDomDocument object associated with this node.
 $child_nodes = array()
 List of child nodes.
 $parent_node = null
 The parent of this node.

Protected Attributes

 $_attributes = null
 Hash of all attributes.
 $allowed_attributes = array()
 List of allowed attributes.
 $must_be_empty = false
 Whether this node can contain children.
 $allowed_elements = array()
 List of allowed child element names.
 $allows_text = true
 Whether this node can have text content.

Private Attributes

 $__object_id = null
 Used for identity checking.


Detailed Description

Base node class.

AnewtXMLDomNode instances cannot be instantiated directly, since this class only serve as a base class for e.g. AnewtXMLDomElement and AnewtXMLDomText.

Todo:
: Implement first_child, last_child, previous_sibling and next_sibling attributes in node trees.

Definition at line 37 of file dom.lib.php.


Member Function Documentation

static AnewtXMLDomNode::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).

Parameters:
$value The value to convert
Returns:
An AnewtXMLDomNode instance (or subclass).

Definition at line 130 of file dom.lib.php.

AnewtXMLDomNode::is_same_node ( other_node  ) 

Returns whether this node is the same node as the given one.

Parameters:
$other_node A AnewtXMLDomNode instance to test against.
Returns:
Returns true if the nodes are the same, false otherwise.
See also:
http://www.w3.org/TR/DOM-Level-3-Core/core.html#Node3-isSameNode

Definition at line 174 of file dom.lib.php.

AnewtXMLDomNode::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.

Parameters:
$new_child The node to add.
Returns:
The node added.
See also:
http://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-184E7107

Reimplemented in AnewtXMLDomDocument.

Definition at line 192 of file dom.lib.php.

AnewtXMLDomNode::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.

Parameters:
$new_children Array of children elements

Definition at line 254 of file dom.lib.php.

& AnewtXMLDomNode::remove_child ( &$  old_child  ) 

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

Parameters:
$old_child The node being removed.
Returns:
The node removed.
See also:
http://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-1734834066

Definition at line 289 of file dom.lib.php.

& AnewtXMLDomNode::replace_child ( &$  new_child,
&$  old_child 
)

Replaces a child node with a new child, and returns the old child node.

Todo:
This method is not implemented yet.
Parameters:
$new_child The new node to put in the child list.
$old_child The node being replaced in the list.
Returns:
The node replaced.
See also:
http://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-785887307

Definition at line 339 of file dom.lib.php.

& AnewtXMLDomNode::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.

Todo:
This method is not implemented yet.
Parameters:
$new_child The node to insert.
$ref_child The reference node, i.e., the node before which the new node must be inserted.
Returns:
The node being inserted.
See also:
http://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-952280727

Definition at line 365 of file dom.lib.php.

AnewtXMLDomNode::has_child_nodes (  ) 

Returns whether this node has any children.

Returns:
Returns true if this node has any children, false otherwise.
See also:
http://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-810594187

Definition at line 382 of file dom.lib.php.


Member Data Documentation

AnewtXMLDomNode::$node_type = null

AnewtXMLDomNode::$node_name = null

The name of this node, depending on its type.

See also:
http://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-F68D095

Reimplemented in AnewtXHTMLForm, AnewtXHTMLInput, AnewtXHTMLButton, AnewtXHTMLTextarea, AnewtXHTMLSelect, AnewtXHTMLOption, AnewtXHTMLOptionGroup, AnewtXHTMLLabel, AnewtXHTMLFieldset, AnewtXHTMLLegend, AnewtXHTMLUnorderedList, AnewtXHTMLOrderedList, AnewtXHTMLListItem, AnewtXHTMLDefinitionList, AnewtXHTMLDefinitionTerm, AnewtXHTMLDefinitionDescription, AnewtXHTMLDiv, AnewtXHTMLSpan, AnewtXHTMLHeader1, AnewtXHTMLHeader2, AnewtXHTMLHeader3, AnewtXHTMLHeader4, AnewtXHTMLHeader5, AnewtXHTMLHeader6, AnewtXHTMLAnchor, AnewtXHTMLLink, AnewtXHTMLBase, AnewtXHTMLImage, AnewtXHTMLScript, AnewtXHTMLMeta, AnewtXHTMLTitle, AnewtXHTMLStyle, AnewtXHTMLTable, AnewtXHTMLTableHead, AnewtXHTMLTableFoot, AnewtXHTMLTableBody, AnewtXHTMLTableColumnGroup, AnewtXHTMLTableColumn, AnewtXHTMLTableRow, AnewtXHTMLTableCell, AnewtXHTMLTableHeaderCell, AnewtXHTMLEmphasis, AnewtXHTMLStrong, AnewtXHTMLDefinition, AnewtXHTMLCode, AnewtXHTMLSample, AnewtXHTMLKeyboard, AnewtXHTMLVariable, AnewtXHTMLCitation, AnewtXHTMLAbbreviation, AnewtXHTMLAcronym, AnewtXHTMLBlockQuote, AnewtXHTMLQuote, AnewtXHTMLSubscript, AnewtXHTMLSuperscript, AnewtXHTMLParagraph, AnewtXHTMLBreak, AnewtXHTMLPreformatted, AnewtXHTMLInsertion, AnewtXHTMLDeletion, AnewtXHTMLTeletype, AnewtXHTMLItalic, AnewtXHTMLBold, AnewtXHTMLBig, AnewtXHTMLSmall, AnewtXHTMLStrike, AnewtXHTMLUnderline, AnewtXMLDomDocument, AnewtXMLDomDocumentFragment, AnewtXMLDomText, AnewtXMLDomComment, and AnewtXMLDomRaw.

Definition at line 51 of file dom.lib.php.

AnewtXMLDomNode::$_attributes = null [protected]

Hash of all attributes.

See also:
http://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-84CF096

Reimplemented in AnewtXMLDomElement.

Definition at line 58 of file dom.lib.php.

AnewtXMLDomNode::$owner_document = null

The AnewtXMLDomDocument object associated with this node.

See also:
http://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-1060184317

Definition at line 65 of file dom.lib.php.

AnewtXMLDomNode::$child_nodes = array()

List of child nodes.

See also:
http://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-84CF096

Definition at line 72 of file dom.lib.php.

AnewtXMLDomNode::$parent_node = null

The parent of this node.

See also:
http://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-84CF096

Definition at line 79 of file dom.lib.php.


The documentation for this class was generated from the following file:

Generated on Sun Aug 2 22:54:38 2009 for Anewt by  doxygen 1.5.9