/** * 生成xml文件 */ function createXml() { $this->load->library('XMLParserLib'); echo '<?xml version=\'1.0\' encoding=\'UTF-8\' ?>'; $xml = new XMLTag('movies', array('version' => '1.0', 'type' => 'documentary', 'encoding' => 'UTF-8')); $xml->AddChild('movie', array(), 1); echo $xml->GetXML(); }
function add_subtag($name, $attributes = 0) { $tag = new XMLTag($this); $tag->set_name($name); if (is_array($attributes)) { $tag->set_attributes($attributes); } $this->tags[] =& $tag; $this->curtag =& $tag; }
protected function onCharacterData($data, XMLTag $element) { $element->addChild(new TextElement($this->html_entities($data))); }
public function insertCheckBox($var, $label, $value, $required = false) { $field = new XMLTag('field'); $field->insertAttribute('type', 'boolean'); $field->insertAttribute('var', $var); $field->insertAttribute('label', $label); $field->insertChildElement(XMLTag::newWithCharacterData('value', $value ? '1' : '0')); if ($required) { $field->insertChildElement(new XMLTag('required')); } $this->tag->insertChildElement($field); }
protected function onCharacterData($data, XMLTag $element) { $data = trim($data); if (!empty($data)) { $element->addChild(new TextElement($data)); } }
public function __construct(XMLTag $command) { $this->cmdtag = $command; $this->form = is_null($form = $command->getChildByAttribute('x', 'xmlns', 'jabber:x:data')) ? NULL : new Form($form); }
private function handleStreamStart(XMLTag $tag) { $this->send('<handshake>' . sha1($tag->getAttribute('id') . $this->password) . '</handshake>'); }
/** * Constructs a BSMAvatar instance from a <PHOTO> tag of the vCard * @param BSMXMLTag link to an instance of BSMXMLTag representing <PHOTO> element of the vCard */ public function __construct(XMLTag $photo_tag) { $this->tag = $photo_tag; file_put_contents($this->filename = tempnam(sys_get_temp_dir(), 'xmpp_avatar'), base64_decode($photo_tag->getChildValue('BINVAL'))); //parent::__construct($this->filename); }