Arquivos
hhvm/hphp/test/slow/simple_xml/simplexml_import_dom.php
T
Paul Tarjan d8d1e7f840 add simplexml_import_dom
This is needed for Symphony.

I copied the zend implementation and then cargocult programmed the rest from the other 2 functions in the file.

Closes #789
2013-05-30 17:39:21 -07:00

21 linhas
501 B
PHP

<?php
$string = <<<EOT
<?xml version="1.0" encoding="UTF-8"?>
<entry xmlns="http://www.w3.org/2005/Atom"
xmlns:other="http://other.w3.org/other" >
<id>uYG7-sPwjFg</id>
<published>2009-05-17T18:29:31.000Z</published>
</entry>
EOT;
$doc = new DOMDocument;
$doc->loadXML($string);
$xml = simplexml_import_dom($doc);
$xml->registerXPathNamespace('atom', "http://www.w3.org/2005/Atom");
$nodes = $xml->xpath('//atom:entry/atom:published/text()');
foreach ($nodes as $node) {
print $node;
}