Having problems with this file http://www.pada.co.uk/cats.xml
Using the auto detect it fails and Ive tried
MagicParser_parse("$url","myRecordHandler","xml|GETCATEGORYLISTINGSRESPONSE/ITEMARRAY/");
But no luck. Im I missing somthing obvious?
Thanks
Hi,
It looks like the format string you're using isn't valid for that XML that is being returned currently. This is because SUBCATEGORIES is a child element of the top level; not CATEGORIES, so the correct format string I think should be:
xml|GETCATEGORYLISTINGSRESPONSE/SUBCATEGORIES/CATEGORY/
I just tried this new format string in your code, which then worked correctly:
<?php
require("MagicParser.php");
$url = "http://www.pada.co.uk/cats.xml";
function myRecordHandler($item)
{
print "<B><a href='".$item["CATEGORYID"]."'>".$item["CATEGORYNAME"]."</a></B>";
}
MagicParser_parse("$url","myRecordHandler","xml|GETCATEGORYLISTINGSRESPONSE/SUBCATEGORIES/CATEGORY/");
?>
Cheers,
David.
Damn you've got good eyes. Thanks David. Would'nt believe how long ive been looking at that. I need a new pair of glasses :/
Dont worry fixed the bit above.
But can you spot why this does not work. Im not getting anything back.
<?php
require("MagicParser.php");
$url = "http://www.pada.co.uk/cats.xml";
function myRecordHandler($item)
{
print "<B><a href='".$item["CATEGORYID"]."'>".$item["CATEGORYNAME"]."</a></B>";
}
MagicParser_parse("$url","myRecordHandler","xml|GETCATEGORYLISTINGSRESPONSE/CATEGORY/SUBCATEGORIES/CATEGORY/");
?>