pagegen Posted July 26, 2010 Share Posted July 26, 2010 <success type="bestseller">4</success> <success type="bookclubs">9</success> Hi i just need to know how I can read the "type" in the above example using php please, Link to comment https://forums.phpfreaks.com/topic/208919-xml-help/ Share on other sites More sharing options...
Maq Posted July 26, 2010 Share Posted July 26, 2010 Hi i just need to know how I can read the "type" in the above example using php please, I'd recommend using SimpleXML. Link to comment https://forums.phpfreaks.com/topic/208919-xml-help/#findComment-1091281 Share on other sites More sharing options...
pagegen Posted July 26, 2010 Author Share Posted July 26, 2010 <?php $string = <<<XML <a> <foo name="one" game="lonely">1</foo> </a> XML; $xml = simplexml_load_string($string); foreach($xml->foo[0]->attributes() as $a => $b) { echo $a,'="',$b,"\"\n"; } ?> http://us2.php.net/manual/en/simplexmlelement.attributes.php Thank you Maq Link to comment https://forums.phpfreaks.com/topic/208919-xml-help/#findComment-1091289 Share on other sites More sharing options...
Daniel0 Posted July 26, 2010 Share Posted July 26, 2010 You're doing it wrong. The standard procedure of getting help around here is repeating "it still doesn't work" until someone has written you a complete solution that you can plug into your existing system effortlessly Link to comment https://forums.phpfreaks.com/topic/208919-xml-help/#findComment-1091295 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.