39 bool $a_remove_childs =
true 41 $search = $a_successors;
42 $search[] = $a_node_name;
48 foreach ($childs as $child) {
49 $child_name = $child->node_name();
51 if (in_array($child_name, $search)) {
61 if ($a_content !=
"") {
62 $new_node->set_content($a_content);
66 if ($child_name == $a_node_name) {
67 if ($a_remove_childs) {
68 $childs2 = $child->child_nodes();
69 for (
$i = 0;
$i < count($childs2);
$i++) {
70 $child->remove_child($childs2[
$i]);
73 if ($a_content !=
"") {
74 $child->set_content($a_content);
79 $new_node = $child->insert_before($new_node, $child);
80 if ($a_content !=
"") {
81 $new_node->set_content($a_content);
96 foreach ($a_attributes as $attribute => $value) {
115 foreach ($childs as $child) {
116 $child_name = $child->node_name();
117 if (in_array($child_name, $a_node_names)) {
118 $child->unlink_node();
136 $search = $a_successors;
139 $cnt_childs = count($childs);
141 foreach ($childs as $child) {
142 $child_name = $child->node_name();
143 if (in_array($child_name, $search)) {
153 $new_node = $child->insert_before($new_node, $child);
155 if ($a_content !=
"") {
156 $new_node->set_content($a_content);
create_element(string $name)
static setFirstOptionalElement(php4DOMDocument $doc, php4DOMElement $parent_node, string $a_node_name, array $a_successors, string $a_content, array $a_attributes, bool $a_remove_childs=true)
searches for an element $a_node_name within the childs of $parent_node if no node is found...
static addElementToList(php4DOMDocument $doc, php4DOMElement $parent_node, string $a_node_name, array $a_successors, string $a_content, array $a_attributes)
Places a new node $a_node_name directly before nodes with names of $a_successors. ...
set_attribute($name, $value)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static deleteAllChildsByName(php4DOMElement $a_parent, array $a_node_names)
delete all childs of a node by names in $a_node_names
static set_attributes(php4DOMElement $a_node, array $a_attributes)
set attributes of a node