| Adds the specified node as a child of the current node. |
Signature: &appendChild(&$child) |
Parameters:
DOMIT_Node child - The node that is to be appended.
|
Returns:
DOMIT_Node - The appended node.
|
Example:
A child node is appended to the $myElement node: $myElement->appendChild($elementNode); |
| Inserts node $newChild before $refChild in the childNodes of $this. If $refChild does not exist, $newChild is appended to the node chain. |
Signature: &insertBefore(&$newChild, &$refChild) |
Parameters:
DOMIT_Node newChild - The new node to be added
DOMIT_Node refChild - The existing node before which the new node will be added
|
Returns:
DOMIT_Node - A reference to the new node being added.
|
Example:
The following example inserts a "Book" node named $goodNovel before another named $okNovel in a childNodes list named $bestSellers. $bestSellers->insertBefore($goodNovel, $okNovel); |
| Replaces node $oldChild with $newChild. |
Signature: replaceChild(&$newChild, &$oldChild) |
Parameters:
DOMIT_Node newChild - The new node that is to replace the old node.
DOMIT_Node oldChild - The old node that is to be replaced by the new node.
|
Returns:
DOMIT_Node - The new node $newChild, or false if $oldChild does not exist.
|
Example:
An old $userProfile node is replaced by a new node: $userProfile->replaceChild($newProfile, $oldProfile); |
| Removes the specified node from the document. |
Signature: &removeChild(&$oldChild) |
Parameters:
DOMIT_Node oldChild - The node that is to be removed.
|
Returns:
DOMIT_Node - The deleted node $oldChild, or false if $oldChild does not exist.
|
Example:
Node $unpopularNovel is removed from the $bestSellers parent node. $bestSellers->removeNode($unpopularNovel); |
| Searches the element tree for an element with the specified attribute name and value (intended as a namespace unaware substitute for getElementByID). |
Signature: &getElementsByAttribute($attrName = 'id', $attrValue = '', $returnFirstFoundNode = false) |
Parameters:
String attrName - The value of the attribute.
String attrValue - The name of the attribute.
boolean returnFirstFoundNode - True if the first found node is to be returned as a node instead of a nodelist.
|
Returns:
DOMIT_NodeList - A NodeList of found elements, or null.
|
Example:
A node list of elements with an attribute named 'myAttr' and a value of '3' is returned. $myNodeList =& $xmldoc->getElementsByAttribute('myAttr', '3'); |