tiki Posted April 3, 2007 Share Posted April 3, 2007 I tried domxpath but failed. So whats an easy way to grab the value "Swordsman" and return it. <human> <units> <light> <name>Swordsman</name> </light> </units> </human> Quote Link to comment Share on other sites More sharing options...
joquius Posted April 3, 2007 Share Posted April 3, 2007 document.getElementsByTagName('name')[0].childNodes[0].nodeValue; but thats js Quote Link to comment Share on other sites More sharing options...
tiki Posted April 3, 2007 Author Share Posted April 3, 2007 document.getElementsByTagName('name')[0].childNodes[0].nodeValue; but thats js And this is a php forum Quote Link to comment Share on other sites More sharing options...
joquius Posted April 3, 2007 Share Posted April 3, 2007 well I don't know, preg_match_all ("/<name>[^<]*<\/name>/", $xml, $names); and if you like foreach ($names[0] as $name) $_names[] = preg_replace ("/<name>([^<]*)<\/name>/", "$1", $name); Quote Link to comment 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.