note 74386 deleted from ref.simplexml by danbrown
| From: | danbrown@php.net | Date: | Mon, 18 May 2009 01:21:51 +0000 |
| Subject: | note 74386 deleted from ref.simplexml by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-155524@lists.php.net to get a copy of this message | ||
Note Submitter: http://methylblue.com
----
It is a grave misfortune that this doesn't work:
<?
$node = new SimpleXml;
echo $node->{"namespace:tagname"}[attribute'];
?>
Instead you have to go through loops!
<?
$namespace = $node->children( 'namespace' );
$attributes = $namespace->tagname->attributes;
echo $attribute['attribute'];
?>
AFAICT there is no simpler way. SimpleXml is great in premise, but useless for things like RSS
feeds, which lets face it, most PHP development with XML is about.
Great shame!