I'm trying trying to use simplexml to read a feedburner xml. I can read every properties in the xml but not the keys with ':' in it. Example "feedburner:origLink". When I vardump the items, those keys with : doesn't show up. And I can't do like $s->item->feedburner:origLink.
Asked
Active
Viewed 722 times
2
-
see http://stackoverflow.com/search?q=[php]+simplexml+namespace – VolkerK Aug 21 '10 at 16:31
2 Answers
3
You're dealing with namespaces, and this Sitepoint article looks like a good long explanation. Or for a more concise version, look here in the PHP SimpleXML
docs.
From the docs:
<?php
$xml = '<example xmlns:foo="my.foo.urn">
<foo:a>Apple</foo:a>
<foo:b>Banana</foo:b>
<c>Cherry</c>
</example>';
$sxe = new SimpleXMLElement($xml);
$kids = $sxe->children('foo');
var_dump(count($kids));
$kids = $sxe->children('foo', TRUE);
var_dump(count($kids));
$kids = $sxe->children('my.foo.urn');
var_dump(count($kids));
$kids = $sxe->children('my.foo.urn', TRUE);
var_dump(count($kids));
$kids = $sxe->children();
var_dump(count($kids));
?>
Outputs:
int(0)
int(2)
int(2)
int(0)
int(1)

Tim Lytle
- 17,549
- 10
- 60
- 91
1
If you're lazy and don't mind using google webservices, here's an easy way to get the full contents of a feedburner (or other) feed into php:
You can then just json_decode it and it's all there in your object/array.

Arie
- 640
- 8
- 16
-
Agree, It is really an easy way to get the full contents of a feedburner. Open a wide flexibility for a customized display. – eQ19 Feb 25 '16 at 18:28