Internally PHPTAL represents documents using it's own document object model, a little bit similar to W3C's DOM. However, PHPTAL's API has only few basic methods for DOM manipulation.
PHPTAL_Dom_Element class has following properties and methods:
array childNodes ;
Numerically indexed array containing children of the element.
Please don't edit this array directly. Use
PHPTAL does not implement
PHPTAL_Dom_Element parentNode ;
Parent node (element) of the current element. Use it to traverse tree upwards.
Appends node to the element. Node will be removed from its current element and added at the end of this element.
PHPTAL does not manage namespace declarations. Moving nodes between elements in different namespaces will change meaning of the document.
Old node will be replaced with new node.
Remove node from its parent.
Returns unescaped (without entities) value of a specific attribute.
In XML attributes don't inherit element's namespace, and all XHTML attributes are in the default namespace.
Returns array of
PHPTAL_Dom_Attr objects, which represent all element's attributes. You can modify attributes' values without using
void setAttributeNodes(array $attrs);
Replaces all elements attributes with the given ones.
Returns local name of the element, e.g.
<atom:title> has local name
Returns namespace URI of the the element, e.g.
<atom:title xmlns="http://www.w3.org/2005/Atom"> has namespace
XHTML namespace is
Text, CDATA and attribute nodes have
setValueEscaped() methods which allow reading/setting of their text with entities preserved.