name = $n; $this->value = $v; $this->parent = $p; } function getParent() { return $this->parent; } function getName() { return $this->name; } function setName($n) { $this->name = $n; } function setValue($v) { $this->value = $v; } function addArg($k,$v) { $this->args[$k] = $v; } function getArg($k) { return $this->args[$k]; } function clearArg($k) { unset($this->args[$k]); } function addChild($c) { $this->children[] = $c; } function generate($indent) { $xml = ""; #for($i=0;$i<$indent;$i++) { $xml .= $indent; #} $xml .= "<".strtolower($this->name); foreach($this->args as $key=>$elem) { $xml .= ' '.strtolower($key).'="'.$elem.'"'; } if(sizeof($this->children) > 0) { $xml .= ">\n"; foreach($this->children as $elem) { $xml .= $elem->generate($indent.' '); } #for($i=0;$i<$indet;$i++) { $xml .= $indent; #} $xml .= "name).">\n"; } elseif($this->value !== null) { $xml .= ">".$this->value."name).">\n"; } else { $xml .= " />\n"; } return $xml; } } ?>