jrw4 Posted October 19, 2009 Share Posted October 19, 2009 What is up with this. Look at: http://www.php.net/manual/en/function.simplexml-load-file.php There is no documentation with the ns parameter of that function and I am currently trying to deal with namespaces in an XML feed. Quote Link to comment https://forums.phpfreaks.com/topic/178185-lack-of-simplexml-documentation/ Share on other sites More sharing options...
trq Posted October 19, 2009 Share Posted October 19, 2009 What do you want use to do about it? Quote Link to comment https://forums.phpfreaks.com/topic/178185-lack-of-simplexml-documentation/#findComment-939485 Share on other sites More sharing options...
jrw4 Posted October 19, 2009 Author Share Posted October 19, 2009 I am using a feed (http://earthquake.usgs.gov/eqcenter/catalogs/eqs7day-M5.xml) with the google maps API to try and make a map with markers of all earthquakes in the last 7 days. I am trying to get simplexml_load_file to recognize the geo namespace but there's no documentation on it. Quote Link to comment https://forums.phpfreaks.com/topic/178185-lack-of-simplexml-documentation/#findComment-939487 Share on other sites More sharing options...
Mark Baker Posted October 19, 2009 Share Posted October 19, 2009 It may not be well documented on php.net, but there's plenty of blogs, explanations and postings that do explain how to use namespaces with simpleXML Quote Link to comment https://forums.phpfreaks.com/topic/178185-lack-of-simplexml-documentation/#findComment-939545 Share on other sites More sharing options...
salathe Posted October 19, 2009 Share Posted October 19, 2009 There is no documentation with the ns parameter of that function and I am currently trying to deal with namespaces in an XML feed. Hi there, if you would click on the "Report a bug" link on that page and fill out a documentation bug report then the documentation team will be made aware of the omission. If you could do that, it would be great. I am using a feed (http://earthquake.usgs.gov/eqcenter/catalogs/eqs7day-M5.xml) with the google maps API to try and make a map with markers of all earthquakes in the last 7 days. I am trying to get simplexml_load_file to recognize the geo namespace but there's no documentation on it. By default, simplexml_load_file creates (a heirarchy of) SimpleXMLElement objects and you can use the SimpelXMLElement::children method to access namespaced child nodes. A quick example would be: $xml = simplexml_load_file('http://earthquake.usgs.gov/eqcenter/catalogs/eqs7day-M5.xml'); foreach ($xml->channel->item as $item) { $geo = $item->children('geo', TRUE); echo "At " . $geo->lat . "," . $geo->long . " was " . $item->title . ".\n"; } Quote Link to comment https://forums.phpfreaks.com/topic/178185-lack-of-simplexml-documentation/#findComment-939555 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.