This week's book giveaway is in the OCMJEA forum. We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line! See this thread for details.
based on this XML I need to get all the nodes under <details> where <list> is C so for exmaple if the list is C than I need all the nodes and their values where list = C I can do that by providing this in my xpath.
Your XPath expression returns a list of three <details> elements. Your subsequent code just prints the names of those elements (namely "detail") and the value of their first children, which are always just whitespace text nodes. You don't want that.
But you say you want to print information about the children of those <details> elements. So you're going to have to write code to examine the children and -- for the children which are elements -- print the element name and the contents of the child's first child.