Class DOMIT_Element
A class representing the DOM Element.

isPublic? yes
isAbstract? no

Inheritance tree:

DOMIT_Node
|
DOMIT_Element

Known subclasses:

None

Source file: xml_domit_parser.php




Constructor
Initializes DOMIT_Element variables and those of the superclass.

Signature: DOMIT_Element()

isPublic? no




Public Constants



Private Constants



Public Fields



Private Fields



Public Methods
appendChild
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);

getText
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();

getAttribute
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");

setAttribute
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");

removeAttribute
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");

hasAttribute
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");

toString
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());




Private Methods
createClone
Used by cloneNode() to generate a new instance of a DOMIT_Element containing the same data as the original.

Signature: &createClone()

Returns:

DOMIT_Element - A new DOMIT_Element


Documentation generated by ClassyDoc, using the DOMIT! and SAXY parsers.
Please visit Engage Interactive to download free copies.