Showing posts with label XML. Show all posts
Showing posts with label XML. Show all posts

Thursday, 18 February 2010

Parsing RSS with Dubin Core using PHP5

With the built-in XML functions of PHP5, its now pretty straightforward to parse well-formed RSS data, eg:

$link = $node->getElementsByTagName('link')->item(0)->nodeValue;

But when using getElementsByName you run into problems if you want to grab data in Dublin Core fields - this won't work:

$creator = $node->getElementsByTagName('dc:creator')->item(0)->nodeValue;

To solve this you have to use the getElementsByTagNameNS function and declare the namespace you are using - obviously in this case Dublin Core:

$creator = $node->getElementsByTagNameNS('http://purl.org/dc/elements/1.1/','creator')->item(0)->nodeValue;

Thursday, 20 March 2008

Mashups workshop
Mashups workshop,
originally uploaded by hockeyshooter.
Following Tony's demonstrations with Yahoo Pipes (which I had briefly looked at before but got nowhere with) I had another play this evening and produced http://tinyurl.com/2axs6y which puts all places mentioned in the last 50 news stories from my department's website onto a Yahoo Map. I wanted to go a bit further and use Google Maps instead, but its just too slow loading in all the data.