You said it does not work but failed to indicate the error messages received and provided very little code. That said, I can see a possible problem or two from the little info you did provide.
At
I think you really want XPathExpression
In the call to
you are passing the interface Document instead of the reference to document.
You're trying to do something with emailNodes when you probably mean phoneNodes.
And I don't believe there is a getAttribute(
String) method on the Node API You probably want something more like
Have another read on th API. Hope this didn't give away a homework assignment.