public function parse($xml) { $dom = ar_xml::parse($xml); $channel = $dom->rss->channel[0]; $this->bind($channel->title, 'title')->bind($channel->link, 'link')->bind($channel->description, 'description')->bind($channel->language, 'language')->bind($channel->copyright, 'copyright')->bind($channel->managingEditor, 'managingEditor')->bind($channel->webMaster, 'webMaster')->bind($channel->pubDate, 'pubDate')->bind($channel->lastBuildDate, 'lastBuildDate')->bind($channel->category, 'category')->bind($channel->generator, 'generator')->bind($channel->cloud->attributes, 'cloud', 'array')->bind($channel->ttl, 'ttl', 'int')->bind($channel->image->attributes, 'image', 'array')->bindAsArray($channel->item, 'items', array('ar_connect_rssClient', 'parseItem'))->bind($dom, 'rawXML', 'xml'); return $this; }
public static function configure($option, $value) { switch ($option) { case 'xhtml': self::$xhtml = (bool) $value; break; default: parent::configure($option, $value); break; } }
function toString($indent = '', $current = 0) { $indent = ar_xml::$indenting ? $indent : ''; $result = "\n" . $indent . '<' . ar_xml::name($this->tagName); if (is_array($this->attributes)) { foreach ($this->attributes as $name => $value) { $result .= ar_xml::attribute($name, $value, $current); } } else { if (is_string($this->attributes)) { $result .= ltrim(' ' . $this->attributes); } } if ($this->childNodes instanceof ar_xmlNodes && count($this->childNodes)) { $result .= '>'; $result .= $this->childNodes->toString(ar_xml::$indent . $indent); if (substr($result, -1) == ">") { $result .= "\n" . $indent; } $result .= '</' . ar_xml::name($this->tagName) . '>'; } else { $result .= ' />'; } return $result; }