Blood_Wolf89 Blood_Wolf89 - 6 months ago 43
PHP Question

echo selected data in php from xml

I need to parse the linked XML. How would I select a dynamic tag (in this case _0F2E09D773BD4A4B9B9F74D7A8B99A51) and echo damagedealt for Blood_Wolf89?

Pastebin to xml data


Just one line:

echo simplexml_load_file('test.xml')->xpath("//*[@playername='Blood_Wolf89'][ancestor::_0F2E09D773BD4A4B9B9F74D7A8B99A51]")[0]['damagedealt'];

But this require known tag name of ancestor. Because without ancestor you have many Blood_Wolf89 results.