xml = new DOMDocument; $this->currentNode = $this->xml; $this->currentParents = array(); } public function formatElement($form_ctl, $elem = null, $value = null, $attrs = array()) { if ($form_ctl == self::FC_END) { $this->currentNode = array_pop($this->currentParents); return; } $elemNode = $this->xml->createElement($elem); if (isset($value)) { $elemNode->nodeValue = $value; } foreach ($attrs as $attr_key => $attr_val) { $attr = $this->xml->createAttribute($attr_key); $attr->nodeValue = $attr_val; $elemNode->appendChild($attr); } $this->currentNode->appendChild($elemNode); if ($form_ctl == self::FC_BEG) { array_push($this->currentParents, $this->currentNode); $this->currentNode = $elemNode; } } public function finish() { ; } public function printIt() { return $this->xml->saveXML(); } }