tags:

views:

16

answers:

1

How would I call this element via SimpleXML?

$xml->ls:viewMinutesThisWeek definitely wouldn't work

   <ls:viewerMinutesThisWeek>5700</ls:viewerMinutesThisWeek>
+2  A: 

Since ls is a namespace, you need to filter elements that are of that namespace using the SimpleXMLElement::children() method. Try this:

$ls = $xml->children('ls', true);
echo $ls->viewerMinutesThisWeek;
BoltClock
Wont he need to register the namespaces first regardless of if they are properly declared in the document?
prodigitalson
@prodigitalson: Passing in `true` as the second parameter as I have done will render that unnecessary.
BoltClock
Sweet, works perfectly, thanks!
Webnet