DomNode- append_child

( unknown )

DomNode- append_child -- Adds new child at the end of the children

Description

object DomNode- append_child ( object newnode)

The child can be created with e.g . DomDocument_create_element( ) , DomDocument_create_text( ) etc . or simply by using any other node .

Before a new child is appended it is first duplicated .

דוגמה 1 .




The above example could also be written as the following:

דוגמה 2 .




A more comples example is the one below. It first searches for a certain element, duplicates it including its children and adds it as a sibling. Finally a new attribute is added to one of the children of the new sibling and the whole document is dumped.

דוגמה 3 .




The above example could also be done with DomNode_insert_before() instead of DomNode_append_child() .

See also DomNode_insert_before( ) .