Adds the specified node as a child of the current DOMIT_Element. |
Signature: appendChild(&$child) |
Parameters:
DOMIT_Element child - The node that is to be appended.
|
Returns:
DOMIT_Element - The appended DOMIT_Elementnode.
|
Example:
A child node is appended to the $myElement node: $myElement->appendChild($elementNode); |
Returns the text contained in all DOMIT_TextNodes and DOMIT_CDataSections that are children of the specified starting node |
Signature: getText() |
Example:
All text and cdata nodes in the document will be concatenated and returned. $allDocmentText = $xmldoc->getText(); |
Returns the value of attribute with the specified name. |
Signature: getAttribute($name) |
Parameters:
String name - The name of the attribute whose value is to be retrieved.
|
Returns:
String - The value of the name attribute, or an empty string if the attribute is not found.
|
Example:
The value of the attribute name "myatt" is returned. $attValue = $anElement->getAttribute("myatt"); |
Sets the value of the named attribute. |
Signature: setAttribute($name, $value) |
Parameters:
String name - The name of the attribute whose value is to be set.
String value - The value to which the named attribute should be set.
|
Example:
The value of the attribute named "myatt" is set to "10". $anElement->setAttribute("myatt", "10"); |
Removes the named attribute if it exists. |
Signature: removeAttribute($name) |
Parameters:
String name - The name of the attribute to be removed.
|
Example:
The attribute named "myatt" is removed. $anElement->removeAttribute("myatt"); |
Tests whether an attribute with the specified name exists. |
Signature: hastAttribute($name) |
Parameters:
String name - The name of the attribute to test for.
|
Returns:
boolean - True if the attribute exists, false if it does not.
|
Example:
True is returned if the element has an attribute named "myatt". $exists = $anElement->hasAttribute("myatt"); |
Generates an unformatted (single line, no whitespace) string representation of the element and all children. |
Signature: toString() |
Returns:
String - An unformatted (single line, no whitespace) string representation of the element and all children.
|
Example:
An unformatted string representation of the element will be printed here: echo (htmlentities($myElement->toString()); |