diff -r 5b37998e522e -r 162c1de6545a web/lib/Zend/Feed/Reader/Extension/FeedAbstract.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/web/lib/Zend/Feed/Reader/Extension/FeedAbstract.php Fri Mar 11 15:05:35 2011 +0100 @@ -0,0 +1,189 @@ +_domDocument = $dom; + + if ($type !== null) { + $this->_data['type'] = $type; + } else { + $this->_data['type'] = Zend_Feed_Reader::detectType($dom); + } + + if ($xpath !== null) { + $this->_xpath = $xpath; + } else { + $this->_xpath = new DOMXPath($this->_domDocument); + } + + $this->_registerNamespaces(); + } + + /** + * Get the DOM + * + * @return DOMDocument + */ + public function getDomDocument() + { + return $this->_domDocument; + } + + /** + * Get the Feed's encoding + * + * @return string + */ + public function getEncoding() + { + $assumed = $this->getDomDocument()->encoding; + return $assumed; + } + + /** + * Get the feed type + * + * @return string + */ + public function getType() + { + return $this->_data['type']; + } + + + /** + * Return the feed as an array + * + * @return array + */ + public function toArray() // untested + { + return $this->_data; + } + + /** + * Set the XPath query + * + * @param DOMXPath $xpath + * @return Zend_Feed_Reader_Extension_EntryAbstract + */ + public function setXpath(DOMXPath $xpath) + { + $this->_xpath = $xpath; + $this->_registerNamespaces(); + return $this; + } + + /** + * Get the DOMXPath object + * + * @return string + */ + public function getXpath() + { + return $this->_xpath; + } + + /** + * Get the XPath prefix + * + * @return string + */ + public function getXpathPrefix() + { + return $this->_xpathPrefix; + } + + /** + * Set the XPath prefix + * + * @return Zend_Feed_Reader_Feed_Atom + */ + public function setXpathPrefix($prefix) + { + $this->_xpathPrefix = $prefix; + } + + /** + * Register the default namespaces for the current feed format + */ + abstract protected function _registerNamespaces(); +}