SimpleXML

Load XML file:

 

Get attribute values:

 

Find the first node with a attribute value:
$node = $xml->xpath(‘//‘ . $table . ‘/item[@formName=”‘ . $formFieldName . ‘”][1]‘);
*Above statement will search any place in this XML and return an Array object:
(String)$challenge[0]->label[0];

Search from root node:
$node = $xml->xpath(‘/rootNode/child’);

http://www.w3schools.com/xpath/xpath_syntax.asp

Another practical example:

 

Get attributes: