note 53413 modified in function.simplexml-element-children by danbrown
| From: | danbrown@php.net | Date: | Wed, 16 Sep 2009 15:35:18 +0000 |
| Subject: | note 53413 modified in function.simplexml-element-children by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-160640@lists.php.net to get a copy of this message | ||
For anyone who hasn't read Sterling Hughe's article
(http://www.zend.com/php5/articles/php5-simplexml.php):
<?php
$xml_document =<<<EOT
<?xml version="1.0"?>
<root xmlns:foo="http://example.com">
<foo:bar>baz</foo:bar>
</root>
EOT;
$xml_document = simplexml_load_xml($xml_document);
$foo_ns_bar = $xml_document->children('http://example.com');
echo $foo_ns_bar->bar[0]; // prints 'baz'
?>
--was--
For anyone who hasn't read Sterling Hughe's article
(http://www.zend.com/php5/articles/php5-simplexml.php):
<?php
$xml_document =<<<EOT
<?xml version="1.0"?>
<root xmlns:foo="http://google.com">
<foo:bar>baz</foo:bar>
</root>
EOT;
$xml_document = simplexml_load_xml($xml_document);
$foo_ns_bar = $xml_document->children('http://google.ca');
echo $foo_ns_bar->bar[0]; // prints 'baz'
?>
http://php.net/manual/en/function.simplexml-element-children.php