open() публичный Метод

Opens an XML file for parsing
public open ( string $XML ) : RDFParser
$XML string
Результат RDFParser
Пример #1
0
 /**
  * Construct a new FileEntity
  *
  * @param  string       $file
  * @param  \DOMDocument $dom
  * @param  RDFParser    $parser
  * @return FileEntity
  */
 public function __construct($file, \DOMDocument $dom, RDFParser $parser)
 {
     $this->dom = $dom;
     $this->file = $file;
     $this->cache = new ArrayCache();
     $this->parser = $parser->open($dom->saveXML());
     return $this;
 }
Пример #2
0
 /**
  * @covers PHPExiftool\RDFParser::Query
  * @covers PHPExiftool\RDFParser::readNodeValue
  */
 public function testQuery()
 {
     $xml = "<?xml version='1.0' encoding='UTF-8'?>\n            <rdf:RDF xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'>\n            <rdf:Description xmlns:NeutronSpace='http://ns.exiftool.ca/NeutronSpace/1.0/'>\n                <NeutronSpace:SpecialRomain>Hello World !</NeutronSpace:SpecialRomain>\n                <NeutronSpace:SpecialRomainbase64 rdf:datatype='http://www.w3.org/2001/XMLSchema#base64Binary'>SGVsbG8gYmFzZTY0ICE=</NeutronSpace:SpecialRomainbase64>\n                <NeutronSpace:Multi>\n                    <rdf:Bag>\n                        <rdf:li>romain</rdf:li>\n                        <rdf:li>neutron</rdf:li>\n                    </rdf:Bag>\n                </NeutronSpace:Multi>\n            </rdf:Description>\n            </rdf:RDF>";
     $this->object->open($xml);
     $metadata_simple = $this->object->Query('NeutronSpace:SpecialRomain');
     $metadata_base64 = $this->object->Query('NeutronSpace:SpecialRomainbase64');
     $metadata_multi = $this->object->Query('NeutronSpace:Multi');
     $null_datas = $this->object->Query('NeutronSpace:NoData');
     $null_datas_2 = $this->object->Query('NamespaceUnknown:NoData');
     $this->assertNull($null_datas);
     $this->assertNull($null_datas_2);
     $this->assertInstanceOf('\\PHPExiftool\\Driver\\Value\\Mono', $metadata_simple);
     $this->assertInstanceOf('\\PHPExiftool\\Driver\\Value\\Binary', $metadata_base64);
     $this->assertInstanceOf('\\PHPExiftool\\Driver\\Value\\Multi', $metadata_multi);
     $this->assertEquals('Hello World !', $metadata_simple->asString());
     $this->assertEquals('Hello base64 !', $metadata_base64->asString());
     $this->assertEquals(array('romain', 'neutron'), $metadata_multi->asArray());
 }