I have the following xml format
<locale id='us'>
items here
</locale>
How do I get the locale node by its id?
I have the following codes
$xml = simplexml_load_file("config.xml");
$nodes = $xml->xpath('*[id = "us"]');
but i guess it’s not the correct way
Use the
@axis specifier to refer to an attribute:If you want to get an element by ID that can appear anywhere in the document, then use: