/** * Returns an XML data stream of the current filter * * @access public * @param void * @return XMLElement Requested publisher XML data */ public function toXML() { $xml = new GnipSimpleXMLElement("<filter/>"); $xml->addAttribute("name", $this->name); $xml->addAttribute("fullData", $this->fullData); $xml->addOptionalChild("postUrl", $this->postUrl); $xml->addOptionalChild("jid", $this->jid); foreach ($this->rules as $rule) { $rule_node = $xml->addChild("rule"); $rule_node->addAttribute("type", $rule->type); $rule_node->addAttribute("value", $rule->value); } return trim($xml->asXML()); }
/** * Converts the filter to properly formatted XML. * * @return XML formatted filter data */ public function toXML() { $xml = new GnipSimpleXMLElement("<filter/>"); $xml->addAttribute('name', $this->name); $xml->addAttribute('fullData', $this->fullData); $xml->addOptionalChild('postURL', $this->postURL); foreach ($this->rules as $rule) { $rule_node = $xml->addChild('rule', $rule->value); $rule_node->addAttribute('type', $rule->type); } return trim($xml->asXML()); }