Пример #1
0
 /**
  * @see CultureFeed_Cdb_IElement::parseFromCdbXml(SimpleXMLElement
  *     $xmlElement)
  * @return CultureFeed_Cdb_Data_Location
  */
 public static function parseFromCdbXml(SimpleXMLElement $xmlElement)
 {
     if (empty($xmlElement->address)) {
         throw new CultureFeed_Cdb_ParseException("Address missing for location element");
     }
     $address = CultureFeed_Cdb_Data_Address::parseFromCdbXml($xmlElement->address);
     $location = new CultureFeed_Cdb_Data_Location($address);
     if (!empty($xmlElement->label)) {
         $attributes = $xmlElement->label->attributes();
         $location->setLabel((string) $xmlElement->label);
         if (isset($attributes['cdbid'])) {
             $location->setCdbid((string) $attributes['cdbid']);
         }
     }
     if (!empty($xmlElement->actor)) {
         $actor = CultureFeed_Cdb_Item_Actor::parseFromCdbXml($xmlElement->actor);
         $location->setActor($actor);
     }
     return $location;
 }
Пример #2
0
 /**
  * @see CultureFeed_Cdb_IElement::parseFromCdbXml(SimpleXMLElement
  *     $xmlElement)
  * @return CultureFeed_Cdb_Data_ContactInfo
  */
 public static function parseFromCdbXml(SimpleXMLElement $xmlElement)
 {
     $contactInfo = new CultureFeed_Cdb_Data_ContactInfo();
     // Address from contact information.
     if (!empty($xmlElement->address)) {
         $contactInfo->addAddress(CultureFeed_Cdb_Data_Address::parseFromCdbXml($xmlElement->address));
     }
     // Mails.
     if (!empty($xmlElement->mail)) {
         foreach ($xmlElement->mail as $mailElement) {
             $contactInfo->addMail(CultureFeed_Cdb_Data_Mail::parseFromCdbXml($mailElement));
         }
     }
     // Phone numbers.
     if (!empty($xmlElement->phone)) {
         foreach ($xmlElement->phone as $phoneElement) {
             $contactInfo->addPhone(CultureFeed_Cdb_Data_Phone::parseFromCdbXml($phoneElement));
         }
     }
     // Urls.
     if (!empty($xmlElement->url)) {
         foreach ($xmlElement->url as $urlElement) {
             $contactInfo->addUrl(CultureFeed_Cdb_Data_Url::parseFromCdbXml($urlElement));
         }
     }
     return $contactInfo;
 }