News Feed
Jobs Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Lorna Mitchell's Blog:
Fetching Namespaced XML Elements With SimpleXML
November 04, 2010 @ 10:48:14

Lorna Mitchell has a new post to her blog with a quick example of how to get namespaced values with SimpleXML out of a properly formatted XML file.

Recently I was working with some google APIs and needed to retrieve some namespaced elements from the result set. This confused me more than I expected it to so here's my code for the next time I need it (and if you use it too, then great!) I was reading from their analytics data feed API, this returns a few key fields and then multiple tags, each with namespaced children.

The trick is to grab the current document's namespaces (via getNamespaces), finding the key for the ones you want and grabbing them as children.

0 comments voice your opinion now!
simplexml namespace element xml tutorial


blog comments powered by Disqus

Similar Posts

MaltBlue.com: Zend Form Mastery with Zend Config - Part 4 Configuring Zend Validators

Sanisoft Blog: Theming your CakePHP apps (V1.2)

PHPMaster.com: Understanding OAuth - Tweeting from Scratch, Part 2

The OC Food Review Blog: Make your own geovisitor

NETTUTS.com: How to Update your Twitter Status with CodeIgniter


Community Events











Don't see your event here?
Let us know!


introduction hhvm composer framework package language example application symfony2 podcast release component hack facebook opinion install code overview security unittest

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework