Try this XPath:
/object/data[@type="me"]
Which reads as:
- Select (
/
) children of the current element calledobject
- Select (
/
) their children calleddata
- Filter (
[...]
) that list to elements where …- the attribute
type
(the@
means “attribute”) - has the text value
me
- the attribute
So:
$myDataObjects = $simplexml->xpath('/object/data[@type="me"]');
If object
is not the root of your document, you might want to use //object/data[@type="me"]
instead. The //
means “find all descendents” rather than “find all children”.