14 * to license@zend.com so we can send you a copy immediately. |
14 * to license@zend.com so we can send you a copy immediately. |
15 * |
15 * |
16 * @category Zend |
16 * @category Zend |
17 * @package Zend_Service |
17 * @package Zend_Service |
18 * @subpackage Amazon |
18 * @subpackage Amazon |
19 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) |
19 * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) |
20 * @license http://framework.zend.com/license/new-bsd New BSD License |
20 * @license http://framework.zend.com/license/new-bsd New BSD License |
21 * @version $Id: Item.php 21883 2010-04-16 14:57:07Z dragonbe $ |
21 * @version $Id: Item.php 24780 2012-05-08 19:34:59Z adamlundrigan $ |
22 */ |
22 */ |
23 |
23 |
24 |
24 |
25 /** |
25 /** |
26 * @category Zend |
26 * @category Zend |
27 * @package Zend_Service |
27 * @package Zend_Service |
28 * @subpackage Amazon |
28 * @subpackage Amazon |
29 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) |
29 * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) |
30 * @license http://framework.zend.com/license/new-bsd New BSD License |
30 * @license http://framework.zend.com/license/new-bsd New BSD License |
31 */ |
31 */ |
32 class Zend_Service_Amazon_Item |
32 class Zend_Service_Amazon_Item |
33 { |
33 { |
34 /** |
34 /** |
112 /** |
112 /** |
113 * Parse the given <Item> element |
113 * Parse the given <Item> element |
114 * |
114 * |
115 * @param null|DOMElement $dom |
115 * @param null|DOMElement $dom |
116 * @return void |
116 * @return void |
117 * @throws Zend_Service_Amazon_Exception |
117 * @throws Zend_Service_Amazon_Exception |
118 * |
118 * |
119 * @group ZF-9547 |
119 * @group ZF-9547 |
120 */ |
120 */ |
121 public function __construct($dom) |
121 public function __construct($dom) |
122 { |
122 { |
123 if (null === $dom) { |
123 if (null === $dom) { |
124 require_once 'Zend/Service/Amazon/Exception.php'; |
124 require_once 'Zend/Service/Amazon/Exception.php'; |
125 throw new Zend_Service_Amazon_Exception('Item element is empty'); |
125 throw new Zend_Service_Amazon_Exception('Item element is empty'); |
126 } |
126 } |
127 if (!$dom instanceof DOMElement) { |
127 if (!$dom instanceof DOMElement) { |
128 require_once 'Zend/Service/Amazon/Exception.php'; |
128 require_once 'Zend/Service/Amazon/Exception.php'; |
129 throw new Zend_Service_Amazon_Exception('Item is not a valid DOM element'); |
129 throw new Zend_Service_Amazon_Exception('Item is not a valid DOM element'); |
130 } |
130 } |
131 $xpath = new DOMXPath($dom->ownerDocument); |
131 $xpath = new DOMXPath($dom->ownerDocument); |
132 $xpath->registerNamespace('az', 'http://webservices.amazon.com/AWSECommerceService/2005-10-05'); |
132 $xpath->registerNamespace('az', 'http://webservices.amazon.com/AWSECommerceService/2011-08-01'); |
133 $this->ASIN = $xpath->query('./az:ASIN/text()', $dom)->item(0)->data; |
133 $this->ASIN = $xpath->query('./az:ASIN/text()', $dom)->item(0)->data; |
134 |
134 |
135 $result = $xpath->query('./az:DetailPageURL/text()', $dom); |
135 $result = $xpath->query('./az:DetailPageURL/text()', $dom); |
136 if ($result->length == 1) { |
136 if ($result->length == 1) { |
137 $this->DetailPageURL = $result->item(0)->data; |
137 $this->DetailPageURL = $result->item(0)->data; |