Exemplo n.º 1
0
Arquivo: xml.php Projeto: poef/ariadne
 function toString($indent = '', $current = 0)
 {
     $indent = ar_xml::$indenting ? $indent : '';
     $result = "\n" . $indent . '<' . ar_xml::name($this->tagName);
     if (is_array($this->attributes)) {
         foreach ($this->attributes as $name => $value) {
             $result .= ar_xml::attribute($name, $value, $current);
         }
     } else {
         if (is_string($this->attributes)) {
             $result .= ltrim(' ' . $this->attributes);
         }
     }
     if ($this->childNodes instanceof ar_xmlNodes && count($this->childNodes)) {
         $result .= '>';
         $result .= $this->childNodes->toString(ar_xml::$indent . $indent);
         if (substr($result, -1) == ">") {
             $result .= "\n" . $indent;
         }
         $result .= '</' . ar_xml::name($this->tagName) . '>';
     } else {
         $result .= ' />';
     }
     return $result;
 }