public static function from_xml($alias, $itnum, $xmlbuffer, $parent = NULL) { $xml = new SimpleXMLElement($xmlbuffer); $doc = ItemFactory::node($xml, '//xml'); $image = new Image($alias, $itnum, $parent); $image->title = (string) $doc->title; $image->file = (string) $doc->find; return $image; }
public static function from_xml($alias, $itnum, $xmlbuffer, $parent = NULL) { $xml = new SimpleXMLElement($xmlbuffer); $doc = ItemFactory::node($xml, '//xml'); $item = new Item($alias, $itnum, $parent); $item->title = (string) $doc->title; $item->file = (string) $doc->find; $item->description = (string) $doc->descri; $item->subject = (string) $doc->subjec; $item->creator = (string) $doc->creato; $item->type = (string) $doc->type; $item->date = (string) $doc->date; $item->format = (string) $doc->format; $item->set_xml($xmlbuffer); return $item; }
public static function from_xml($alias, $itnum, $xmlbuffer) { $xml = new SimpleXMLElement($xmlbuffer); $doc = ItemFactory::node($xml, '//xml'); $compound_object = new CompoundObject($alias, $itnum); $compound_object->title = (string) $doc->title; $compound_object->file = (string) $doc->find; dmGetCompoundObjectInfo($alias, $itnum, $compound_xml_buffer); $compound_xml = new SimpleXMLElement($compound_xml_buffer); $type = $compound_xml->xpath('//cpd/type'); if ((string) $type[0] == 'Monograph') { $pages = $compound_xml->xpath('//cpd/node/page'); } else { $pages = $compound_xml->xpath('//cpd/page'); } $num = 1; foreach ($pages as $page) { $subitnum = (string) $page->pageptr; $item = ItemFactory::create($alias, $subitnum, NULL); $compound_object->add_item($item, $num++); } return $compound_object; }
public static function create_from_xml($alias, $itnum, $subitnum, $xmlbuffer) { $xml = new SimpleXMLElement($xmlbuffer); $xmlnode = ItemFactory::node($xml, '//xml'); $format = (string) $xmlnode->format; $extension = Item::extension((string) $xmlnode->find); #some items have no format $is_image = array_search($extension, Item::image_extensions()); if ($extension == 'cpd') { // $format == 'Document' || -- inconsistent $compound_object = CompoundObject::from_xml($alias, $itnum, $xmlbuffer); if ($subitnum != NULL) { return $compound_object->item_by_itnum($subitnum); } else { return $compound_object->first_item(); } } else { if ($format == 'Image' || $is_image) { return Image::from_xml($alias, $itnum, $xmlbuffer); } else { return Item::from_xml($alias, $itnum, $xmlbuffer); } } }