I have an xml how can I get the node in levelone that has an attribute called myatt whose value is a and then access it's myval.
I tried referencing other posts to make it work but it doesn't seem to work what's wrong with my xpath
$this->myXmlObj->xpath("//levelone[myfield[attributes/myatt='a]]]"));
<myxml>
<levelone>
<myfield myatt="a" myval="aa" />
<myfield myatt="b" myval="bb" />
</levelone>
<leveltwo>
<myfield myatt="c" myval="dd" />
<myfield myatt="c" myval="dd" />
</leveltwo>
</myxml>
edit 1
array
0 =>
object(SimpleXMLElement)[41]
public '@attributes' =>
array
'myval' => string 'a' (length=40)
edit 2
$myVar = $this->myXmlObj->xpath("//levelone/myfield[@myatt='a']");
$myOutput = ((string)$myVar[0]->attributes()->myVal;