Ejemplo n.º 1
0
 /**
  * Create a new Title.
  *
  * @param mixed $in The <Title> DOMDocument or DOMElement.
  */
 public function __construct($in)
 {
     parent::__construct($in);
     // Retrieve and check the type.
     $type = $this->_getSingleChildElementText('TitleType');
     if (!preg_match('/^[0-9]{2}$/', $type)) {
         throw new ONIXException('wrong format of TitleType');
     }
     $this->type = $type;
     try {
         $this->value['title'] = $this->_getSingleChildElementText('TitleText');
     } catch (\Exception $e) {
     }
     try {
         $this->value['subtitle'] = $this->_getSingleChildElementText('Subtitle');
     } catch (\Exception $e) {
     }
     // try 3.0 structure
     if (!$this->value['title']) {
         try {
             $this->value['title'] = $this->_getSingleChildElementText('TitleElement/TitleText');
         } catch (\Exception $e) {
         }
         try {
             $this->value['subtitle'] = $this->_getSingleChildElementText('TitleElement/Subtitle');
         } catch (\Exception $e) {
         }
     }
     // Save memory.
     $this->_forgetSource();
 }
Ejemplo n.º 2
0
 /**
  * Create a new SalesRights.
  *
  * @param mixed $in The <SalesRights> DOMDocument or DOMElement.
  */
 public function __construct($in)
 {
     parent::__construct($in);
     try {
         $this->type = $this->_getSingleChildElementText('SalesRightsType');
     } catch (\Exception $e) {
     }
     try {
         $this->country = $this->_getSingleChildElementText('RightsCountry');
     } catch (\Exception $e) {
     }
     try {
         $this->territory = $this->_getSingleChildElementText('RightsTerritory');
     } catch (\Exception $e) {
     }
     // try 3.0
     if (!$this->country && !$this->territory) {
         try {
             $this->country = $this->_getSingleChildElementText('Territory/CountriesIncluded');
         } catch (\Exception $e) {
         }
     }
     // Save memory.
     $this->_forgetSource();
 }
Ejemplo n.º 3
0
 /**
  * Create a new Prize.
  *
  * @param mixed $in The <Prize> DOMDocument or DOMElement.
  */
 public function __construct($in)
 {
     parent::__construct($in);
     try {
         $this->name = $this->_getSingleChildElementText('PrizeName');
     } catch (\Exception $e) {
     }
     try {
         $this->year = $this->_getSingleChildElementText('PrizeYear');
     } catch (\Exception $e) {
     }
     try {
         $this->country = $this->_getSingleChildElementText('PrizeCountry');
     } catch (\Exception $e) {
     }
     try {
         $this->code = $this->_getSingleChildElementText('PrizeCode');
     } catch (\Exception $e) {
     }
     // 3.0.2
     try {
         $this->statement = $this->_getSingleChildElementText('PrizeStatement');
     } catch (\Exception $e) {
     }
     // Save memory.
     $this->_forgetSource();
 }
Ejemplo n.º 4
0
 /**
  * Create a new OtherText.
  *
  * @param mixed $in The <OtherText> DOMDocument or DOMElement.
  */
 public function __construct($in)
 {
     parent::__construct($in);
     try {
         $this->type = $this->_getSingleChildElementText('TextTypeCode');
     } catch (\Exception $e) {
     }
     // try 3.0
     if (!$this->type) {
         try {
             $this->type = $this->_getSingleChildElementText('TextType');
         } catch (\Exception $e) {
         }
     }
     try {
         $this->format = $this->_getSingleChildElementText('TextFormat');
     } catch (\Exception $e) {
     }
     try {
         $this->value = $this->_getSingleChildElementText('Text');
     } catch (\Exception $e) {
     }
     try {
         $this->author = $this->_getSingleChildElementText('TextAuthor');
     } catch (\Exception $e) {
     }
     $this->cleanValue();
     // Save memory.
     $this->_forgetSource();
 }
Ejemplo n.º 5
0
 /**
  * Create a new Extent.
  *
  * @param mixed $in The <Extent> DOMDocument or DOMElement.
  */
 public function __construct($in)
 {
     parent::__construct($in);
     $this->type = $this->_getSingleChildElementText('ExtentType');
     $this->value = $this->_getSingleChildElementText('ExtentValue');
     $this->unit = $this->_getSingleChildElementText('ExtentUnit');
     // Save memory.
     $this->_forgetSource();
 }
Ejemplo n.º 6
0
 /**
  * Create a new ProductIdentifier.
  *
  * @param mixed $in The <ProductIdentifier> DOMDocument or DOMElement.
  */
 public function __construct($in)
 {
     parent::__construct($in);
     // Retrieve and check the type.
     $type = $this->_getSingleChildElementText('ProductIDType');
     if (!preg_match('/^[0-9]{2}$/', $type)) {
         throw new ONIXException('wrong format of ProductIDType');
     }
     $this->type = $type;
     // Retrieve the type name (if proprietary type).
     if ($type == self::TYPE_PROPRIETARY) {
         try {
             $this->typename = $this->_getSingleChildElementText('IDTypeName');
         } catch (\Exception $e) {
         }
     }
     // TODO: else: forbid IDTypeName
     // Get the value.
     $this->value = $this->_getSingleChildElementText('IDValue');
     // Save memory.
     $this->_forgetSource();
 }
Ejemplo n.º 7
0
 /**
  * Create a new Contributor.
  *
  * @param mixed $in The <Contributor> DOMDocument or DOMElement.
  */
 public function __construct($in)
 {
     parent::__construct($in);
     // Retrieve and check the type.
     $this->role = $this->_getSingleChildElementText('ContributorRole');
     // Get the value.
     $this->value = array();
     $this->value['ContributorRole'] = $this->role;
     try {
         $this->value['PersonName'] = $this->_getSingleChildElementText('PersonName');
     } catch (\Exception $e) {
     }
     try {
         $this->value['PersonNameInverted'] = $this->_getSingleChildElementText('PersonNameInverted');
     } catch (\Exception $e) {
     }
     try {
         $this->value['SequenceNumber'] = $this->_getSingleChildElementText('SequenceNumber');
     } catch (\Exception $e) {
     }
     try {
         $this->value['NamesBeforeKey'] = $this->_getSingleChildElementText('NamesBeforeKey');
     } catch (\Exception $e) {
     }
     try {
         $this->value['KeyNames'] = $this->_getSingleChildElementText('KeyNames');
     } catch (\Exception $e) {
     }
     try {
         $this->value['Bio'] = $this->_getSingleChildElementText('BiographicalNote');
     } catch (\Exception $e) {
     }
     if ($this->value['Bio']) {
         $this->value['Bio'] = $this->clean($this->value['Bio']);
     }
     // Save memory.
     $this->_forgetSource();
 }