PHPExiftool\RDFParser::ParseEntities PHP 메소드

ParseEntities() 공개 메소드

Parse a XML string and returns an ArrayCollection of FileEntity
public ParseEntities ( ) : ArrayCollection
리턴 Doctrine\Common\Collections\ArrayCollection
    public function ParseEntities()
    {
        /**
         * A default Exiftool XML can contains many RDF Descriptions
         */
        $Entities = new ArrayCollection();
        foreach ($this->getDomXpath()->query('/rdf:RDF/rdf:Description') as $node) {
            /**
             * Let's create a DOMDocument containing a single RDF result
             */
            $Dom = new \DOMDocument();
            $DomRootElement = $Dom->createElementNS(self::RDF_NAMESPACE, 'rdf:RDF');
            $DomRootElement->appendChild($Dom->importNode($node, true));
            $Dom->appendChild($DomRootElement);
            $LocalXpath = new \DOMXPath($Dom);
            $LocalXpath->registerNamespace('rdf', self::RDF_NAMESPACE);
            $RDFDescriptionRoot = $LocalXpath->query('/rdf:RDF/rdf:Description');
            /**
             * Let's associate a Description to the corresponding file
             */
            $file = $RDFDescriptionRoot->item(0)->getAttribute('rdf:about');
            $Entities->set($file, new FileEntity($file, $Dom, new static()));
        }
        return $Entities;
    }