/** * @param XmlBuilder $xml */ function addToXml(&$xml) { // TODO: htmlspecialchars should go here? $name = empty($this->_rootNamespace) ? $this->_name : $this->_rootNamespace . ':' . $this->_name; $value = htmlspecialchars($this->_value); if ($this->_children == null) { if ($value != '') { $xml->Element($name, $value, $this->_attributes); } else { $xml->EmptyElement($name, $this->_attributes); } } else { $xml->Push($name, $this->_attributes); if ($value != '') { $xml->Append($value); } foreach ($this->_children as $child) { $child->addToXml($xml); } $xml->Pop($name); } }