shocker-z Posted March 4, 2008 Share Posted March 4, 2008 Hi all, I was wanting to know how i can parse the name out of this XML Current code attached in txt file as this forum wont let me post it. comes up saying: Method Not Implemented POST to /forums/index.php not supported. Apache/2.2.0 (Linux) Server at www.phpfreaks.com Port 80 Code now shown below, what's happening to the forum people as i'm strugling to post new posts and replys with code in. <?php $xml = '<?xml version="1.0" encoding="UTF-8" ?> <Report> <Student> <name value="liam wheldon"/> <dob value="22/01/1985"/> <srn value="555"/> <grn value=""/> <mathsGrade value=""/> <englishLangGrade value=""/> <englishFirstLang value="Not entered"/> <otherLangHome value="Not entered"/> <otherLangWork value="Not entered"/> <otherLangFriends value="Not entered"/> </Student> </Report>'; if i change <name value="liam wheldon"/> to <name>liam wheldon</name> it will work fine so what do i need to do to change this to get it working as the xml above is a sniplet from XML output by an application which isn't likley to get changed. Regards Liam Link to comment https://forums.phpfreaks.com/topic/94241-xml-parsing/ Share on other sites More sharing options...
shocker-z Posted March 4, 2008 Author Share Posted March 4, 2008 Resolved using $xmloutput = $xml->xpath('/Report/Result/result/@value'); use @ value to pull our variable values. Regards Liam Link to comment https://forums.phpfreaks.com/topic/94241-xml-parsing/#findComment-482737 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.