Chris@0: domDocument = $dom; Chris@0: return $this; Chris@0: } Chris@0: Chris@0: /** Chris@0: * Get the DOM Chris@0: * Chris@0: * @return DOMDocument Chris@0: */ Chris@0: public function getDomDocument() Chris@0: { Chris@0: return $this->domDocument; Chris@0: } Chris@0: Chris@0: /** Chris@0: * Get the Feed's encoding Chris@0: * Chris@0: * @return string Chris@0: */ Chris@0: public function getEncoding() Chris@0: { Chris@0: $assumed = $this->getDomDocument()->encoding; Chris@0: return $assumed; Chris@0: } Chris@0: Chris@0: /** Chris@0: * Set the feed type Chris@0: * Chris@0: * @param string $type Chris@0: * @return AbstractFeed Chris@0: */ Chris@0: public function setType($type) Chris@0: { Chris@0: $this->data['type'] = $type; Chris@0: return $this; Chris@0: } Chris@0: Chris@0: /** Chris@0: * Get the feed type Chris@0: * Chris@0: * If null, it will attempt to autodetect the type. Chris@0: * Chris@0: * @return string Chris@0: */ Chris@0: public function getType() Chris@0: { Chris@0: $type = $this->data['type']; Chris@0: if (null === $type) { Chris@0: $type = Reader\Reader::detectType($this->getDomDocument()); Chris@0: $this->setType($type); Chris@0: } Chris@0: return $type; Chris@0: } Chris@0: Chris@0: /** Chris@0: * Return the feed as an array Chris@0: * Chris@0: * @return array Chris@0: */ Chris@0: public function toArray() // untested Chris@0: { Chris@0: return $this->data; Chris@0: } Chris@0: Chris@0: /** Chris@0: * Set the XPath query Chris@0: * Chris@0: * @param DOMXPath $xpath Chris@17: * @return AbstractFeed Chris@0: */ Chris@0: public function setXpath(DOMXPath $xpath = null) Chris@0: { Chris@0: if (null === $xpath) { Chris@0: $this->xpath = null; Chris@0: return $this; Chris@0: } Chris@0: Chris@0: $this->xpath = $xpath; Chris@0: $this->registerNamespaces(); Chris@0: return $this; Chris@0: } Chris@0: Chris@0: /** Chris@0: * Get the DOMXPath object Chris@0: * Chris@0: * @return string Chris@0: */ Chris@0: public function getXpath() Chris@0: { Chris@0: if (null === $this->xpath) { Chris@0: $this->setXpath(new DOMXPath($this->getDomDocument())); Chris@0: } Chris@0: Chris@0: return $this->xpath; Chris@0: } Chris@0: Chris@0: /** Chris@0: * Get the XPath prefix Chris@0: * Chris@0: * @return string Chris@0: */ Chris@0: public function getXpathPrefix() Chris@0: { Chris@0: return $this->xpathPrefix; Chris@0: } Chris@0: Chris@0: /** Chris@0: * Set the XPath prefix Chris@0: * Chris@0: * @param string $prefix Chris@0: * @return void Chris@0: */ Chris@0: public function setXpathPrefix($prefix) Chris@0: { Chris@0: $this->xpathPrefix = $prefix; Chris@0: } Chris@0: Chris@0: /** Chris@0: * Register the default namespaces for the current feed format Chris@0: */ Chris@0: abstract protected function registerNamespaces(); Chris@0: }