Posts Tagged ‘namespace’

Simple XML Parser Namespace support

October 27th, 2009

I have added support for namespaces to the parser.
What this means, you are now able to register a namspace in order to be able to parse the XML.

Also the usage of this class changed.

<?php

$xml = "http://www.protung.ro/feed/atom/"; // parse an Atom feed

// create a new object
$parser = new SimpleLargeXMLParser();
// load the XML
$parser->loadXML($xml);

// register the namespace
$parser->registerNamespace("atom", "http://www.w3.org/2005/Atom");
// this will get an array of entries
$array = $parser->parseXML("//atom:feed/atom:entry");

?>

As always, you can download the new version from here.

VN:F [1.9.22_1171]
Rating: 8.5/10 (14 votes cast)