60                 $num = func_num_args();
 
   61                 $args = func_get_args();
 
   63                 if (($num == 1) && is_object($args[0]))
 
   65                         $this->doc = $args[0];
 
   77             printf(
"domxml destructor called, class=%s\n", get_class($this).
"<br/>");
 
   99                         $a_encoding = 
"UTF-8";
 
  103                         $a_charset = 
"UTF-8";
 
  107                 $xmlHeader = 
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>". 
 
  114                 $root = $this->doc->document_element();
 
  115                 $root->unlink_node();
 
  134                 if ($root = $this->
getRoot()) {
 
  160                 $this->doc = 
domxml_open_file($a_filepath . 
"/" . $a_filename, $mode, $this->error);
 
  164                         $error_msg = 
"Error(s) while parsing the document!<br><br>";
 
  166                         foreach ($this->error as 
$error) {
 
  167                                 $error_msg .= $error[
"errormessage"].
" in line: ".$error[
"line"].
"<br>";
 
  192                 if ($a_node->has_child_nodes()) {
 
  193                         $childs = $a_node->child_nodes();
 
  195                         foreach ($childs as $child) {
 
  196                                 $content = 
trim($child->get_content());
 
  198                                 if (empty($content)) {
 
  199                                         $child->unlink_node();
 
  217                 if (empty($a_node))     {
 
  221                 $this->
trim($a_node);
 
  262                 $node2 = (array)$node;
 
  269                 $this->tree[$node2[0]][
"struct"] = 0;
 
  271                 if ($parent = $node->parent_node()) {
 
  272                         $parent = (array)$parent;
 
  275                 if ($first = $node->first_child())
 
  277                         $first = (array)$first;
 
  280                 if ($prev = $node->previous_sibling()) {
 
  281                         $prev = (array)$prev;
 
  284                 if ($next = $node->next_sibling()) {
 
  285                         $next = (array)$next;
 
  288                 $this->tree[$node2[0]][
"content"] = 
trim($node->node_value());
 
  289                 $this->tree[$node2[0]][
"name"] = $node->node_name();
 
  290                 $this->tree[$node2[0]][
"type"] = $node->type;
 
  291                 $this->tree[$node2[0]][
"depth"] = $lvl;
 
  292                 $this->tree[$node2[0]][
"parent"] = $parent[0];
 
  293                 $this->tree[$node2[0]][
"first"] = $first[0];
 
  294                 $this->tree[$node2[0]][
"prev"] = $prev[0];
 
  295                 $this->tree[$node2[0]][
"next"] = $next[0];
 
  296                 $this->tree[$node2[0]][
"left"] = $left;
 
  300                 if ($node->has_attributes())
 
  304                         foreach ($node->attributes() as $attribute)
 
  306                                 $data[$attribute->name] = $attribute->value;
 
  309                         $this->tree[$node2[0]][
"attr_list"] = 
$data;
 
  310                         $this->tree[$node2[0]][
"struct"] += 1;
 
  314                 foreach ($node->child_nodes() as $child)
 
  316                         if ($child->node_type() == XML_TEXT_NODE)
 
  318                                 $this->tree[$node2[0]][
"struct"] += 2;
 
  325                 foreach ($node->child_nodes() as $child)
 
  330                 $this->tree[$node2[0]][
"right"] = $left;
 
  346                 if (empty($a_node)) {
 
  367         function dumpDocument ($a_stdout = -1, $a_compress = 
false, $a_format = 
false)
 
  369                 if ($a_stdout != -1) {
 
  370                         $this->doc->dump_file($a_stdout,$a_compress,$a_format);
 
  373                 return $this->doc->dump_mem();
 
  390                 if ($a_element->node_type() == XML_ELEMENT_NODE) {
 
  393                         foreach ($a_element->child_nodes() as $child) {
 
  394                                 if ($child->node_type() == XML_TEXT_NODE) {
 
  395                                         $value .= $child->content;
 
  402                 die(
"<b>".$a_element.
"</b> is not a valid element node!");
 
  419                 if ($childs = $a_node->child_nodes()) {
 
  420                         foreach ($childs as $child) {
 
  429                 if (($a_node->node_type() == XML_ELEMENT_NODE) && ($a_node->tagname == $a_elementname) && ($a_num != 1)) {
 
  449                 if (empty($a_node)) {
 
  453                 if (count($node = $a_node->get_elements_by_tagname($a_elementname)) > 0) {
 
  474                 if (empty($a_prev_sibling))
 
  476                         $node = $a_node->append_child($newnode);
 
  480                         $node = $a_prev_sibling->append_sibling($newnode);
 
  483                 $node->set_attribute(
"id",$a_lo_id);
 
  484                 $node->set_attribute(
"lm",$a_lm_id);
 
  497                 return $this->doc->append_child($a_node);
 
  509                 return $this->doc->document_element();
 
  522                 return $this->doc->create_element($a_node);
 
  527                 $node = $this->doc->create_element($a_node);
 
  528                 $node = $a_parent->append_child($node);
 
  543                 return $this->doc->create_text_node($a_text);
 
  558         function createNode ($a_parent, $a_elementname, $a_attr_list = NULL, $a_text = NULL)
 
  564                 if (is_array($a_attr_list)) {
 
  565                         foreach ($a_attr_list as $attr => $value) {
 
  566                                 $node->set_attribute($attr, $value);
 
  571                 if (is_string($a_text)) {
 
  572                         $node_text = $this->doc->create_text_node($a_text);
 
  573                         $node_text = $node->append_child($node_text);
 
  577                 $node = $a_parent->append_child($node);
 
  591                 $node = (array) $a_node;
 
  604                 return $a_node->node_name();
 
  617                 if (empty($this->doc->encoding) or ($a_overwrite)) {
 
  618                         $this->doc->encoding = $a_encode;
 
  633                 return $this->doc->encoding;
 
  646                 if (is_integer($this->doc->charset) or ($a_overwrite)) {
 
  647                         $this->doc->charset = $a_charset;
 
  662                 return $this->doc->charset;
 
  677                         $childs = $node[0]->child_nodes();
 
  679                         foreach ($childs as $child)
 
  681                                         if (($child->node_type() == XML_ELEMENT_NODE) && ($child->tagname == 
"General"))
 
  683                                                 $childs2 = $child->child_nodes();
 
  685                                                 foreach ($childs2 as $child2)
 
  687                                                         if (($child2->node_type() == XML_ELEMENT_NODE) && ($child2->tagname == 
"Title" || $child2->tagname == 
"Description"))
 
  689                                                                 $arr[$child2->tagname] = $child2->get_content();
 
  700                 $arr[
"title"] = $arr[
"Title"];
 
  701                 $arr[
"desc"] = $arr[
"Description"];
 
  716                         foreach ($nodes as $node)
 
  718                                 $attr[] = $node->get_attribute(
"id");