I am using PHP DOM XPATH. I have XML structure as below
<?xml version="1.0" encoding="UTF-8"?>
<root xmlns:rank="http://www.w3.org/2001/XMLSchema">
<rank:one year = "2015">99</<rank:one>
<rank:two year = "2014">128</rank:two>
<rank:three year = "2015">27</rank:three>
</root>
where I want to get name and value of node where year is 2015
expected output is rank:one -- 99 and rank:three -- 27 I tried to write xpath query as
$xpath->query('//root/[@year="2015"]');
I am not getting what should be xpath expression in this case