49 $a_remove_childs =
true 51 $search = $a_successors;
52 $search[] = $a_node_name;
54 $childs = $parent_node->child_nodes();
55 $cnt_childs = count($childs);
58 foreach ($childs as $child) {
59 $child_name = $child->node_name();
61 if (in_array($child_name, $search)) {
69 $new_node =&$doc->create_element($a_node_name);
70 $new_node =&$parent_node->append_child($new_node);
76 if ($child_name == $a_node_name) {
77 if ($a_remove_childs) {
78 $childs2 = $child->child_nodes();
79 for (
$i=0;
$i<count($childs2);
$i++) {
80 $child->remove_child($childs2[
$i]);
88 $new_node =&$doc->create_element($a_node_name);
89 $new_node =&$child->insert_before($new_node, $child);
106 foreach ($a_attributes as $attribute => $value) {
108 $a_node->set_attribute($attribute, $value);
110 if ($a_node->has_attribute($attribute)) {
111 $a_node->remove_attribute($attribute);
122 $childs = $a_parent->child_nodes();
123 foreach ($childs as $child) {
124 $child_name = $child->node_name();
125 if (in_array($child_name, $a_node_names)) {
126 $child->unlink_node();
144 $search = $a_successors;
146 $childs = $parent_node->child_nodes();
147 $cnt_childs = count($childs);
149 foreach ($childs as $child) {
150 $child_name = $child->node_name();
151 if (in_array($child_name, $search)) {
158 $new_node = $doc->create_element($a_node_name);
159 $new_node = $parent_node->append_child($new_node);
165 $new_node = $doc->create_element($a_node_name);
166 $new_node = $child->insert_before($new_node, $child);
static set_attributes($a_node, $a_attributes)
set attributes of a node
static deleteAllChildsByName($a_parent, $a_node_names)
delete all childs of a node by names in $a_node_names
static addElementToList( $doc, $parent_node, $a_node_name, $a_successors, $a_content, $a_attributes)
Places a new node $a_node_name directly before nodes with names of $a_successors. ...
static setFirstOptionalElement( $doc, $parent_node, $a_node_name, $a_successors, $a_content, $a_attributes, $a_remove_childs=true)
searches for an element $a_node_name within the childs of $parent_node if no node is found...