Retrieve an attribute value using another attribute value in xml


I have an xml file like following

    <mxCell id="0"/>

    <mxCell id="1" parent="0"/><mxCell connectable="0" id="2" parent="1"value="a=5" vertex="1"></mxCell>

<mxCell id="3" parent="2"  value="op1" vertex="1"></mxCell>

<mxCell connectable="0" id="4" parent="1"  value="b=8" vertex="1"></mxCell>

<mxCell id="5" parent="4"  value="ip1" vertex="1"></mxCell>

<mxCell id="6" parent="4"  value="op1" vertex="1"></mxCell>

<mxCell connectable="0" id="7" parent="1"  value="c=_x+_y" vertex="1"></mxCell>

<mxCell id="8" parent="7"  value="ip1" vertex="1"></mxCell>

from the xml file i want to get attribute value of "id" where attribute value of " parent="4" ". Though i know to simply retrieve the attribute values but i want to retrieve the attribute value by the attribute value of another attribute. How can i do this using xml parser in JAVA?

i have done it as following

Element eElement=(Element)nNode;