_httpResponse = $httpResponse; } /** * Gets the XPath object for this response * * @return DOMXPath the XPath object for response. */ public function getXPath() { if ($this->_xpath === null) { $document = $this->getDocument(); if ($document === false) { $this->_xpath = false; } else { $this->_xpath = new DOMXPath($document); $this->_xpath->registerNamespace('sdb', $this->getNamespace()); } } return $this->_xpath; } /** * Gets the SimpleXML document object for this response * * @return SimpleXMLElement */ public function getSimpleXMLDocument() { try { $body = $this->_httpResponse->getBody(); } catch (Zend_Http_Exception $e) { $body = false; } return simplexml_load_string($body); } /** * Get HTTP response object * * @return Zend_Http_Response */ public function getHttpResponse() { return $this->_httpResponse; } /** * Gets the document object for this response * * @return DOMDocument the DOM Document for this response. */ public function getDocument() { try { $body = $this->_httpResponse->getBody(); } catch (Zend_Http_Exception $e) { $body = false; } if ($this->_document === null) { if ($body !== false) { // turn off libxml error handling $errors = libxml_use_internal_errors(); $this->_document = new DOMDocument(); if (!$this->_document->loadXML($body)) { $this->_document = false; } // reset libxml error handling libxml_clear_errors(); libxml_use_internal_errors($errors); } else { $this->_document = false; } } return $this->_document; } /** * Return the current set XML Namespace. * * @return string */ public function getNamespace() { return $this->_xmlNamespace; } /** * Set a new XML Namespace * * @param string $namespace */ public function setNamespace($namespace) { $this->_xmlNamespace = $namespace; } }