XML File parsing

This is XML parser that I wrote in the automation framework to get xpath stored in the XML file with the convention. You can  see how the query is formed expression = “//” + query + “/value”; .

private void initObjects() {
try {
xmlDocument = DocumentBuilderFactory.newInstance()
.newDocumentBuilder().parse(xmlFile);
xPath = XPathFactory.newInstance().newXPath();
} catch (IOException ex) {
ex.printStackTrace();
} catch (SAXException ex) {
ex.printStackTrace();
} catch (ParserConfigurationException ex) {
ex.printStackTrace();
}
}

public String read(String expression, QName returnType) {
try {
XPathExpression xPathExpression = xPath.compile(expression);
NodeList nodeList = (NodeList) xPathExpression.evaluate(xmlDocument, XPathConstants.NODESET);
for(int i=0; i<nodeList.getLength();i++){
Node childNode = nodeList.item(i);
//System.out.println(“From the Read Method : \t”+childNode.getTextContent());
// Do something with childNode…
xpval = childNode.getTextContent();
//return xpval;
}
} catch (XPathExpressionException ex) {
ex.printStackTrace();
}
return xpval;
}
public static String SearchQuery(String query) {
File file = new File(“”);
try {
throw new Exception(“Who called me?”);
} catch (Exception e) {
filename= e.getStackTrace()[1].getMethodName();
System.out.println(“I was called by class: \t” +    filename);
}
//xprec = file.getAbsolutePath() + “/config/” + filename + “.xml”;
XPathReader reader = new XPathReader(file.getAbsolutePath() + “/config/” + filename + “.xml”);
String expression = “//” + query + “/value”;

return reader.read(expression, XPathConstants.STRING);

}