26 February 2015 14 3K Report

I have tried:

{

File configFile= new File("C:\\ Documents and Settings\\student\\My Documents\\NetBeansProjects\\CDAS\\src\\config.xml ");

DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();

DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();

Document doc = dBuilder.parse(fXmlFile);

doc.getDocumentElement().normalize();

NodeList nList = doc.getElementsByTagName("config");

for (int temp = 0; temp < nList.getLength(); temp++) {

Node nNode = nList.item(temp);

if (nNode.getNodeType() == Node.ELEMENT_NODE) {

Element eElement = (Element) nNode;

String input=eElement.getElementsByTagName("inputAws").it em(0).getTextContent();

String processed=eElement.getElementsByTagName("processed Aws").item(0).getTextContent();

String unprocessed=eElement.getElementsByTagName("unproce ssedAws").item(0).getTextContent();

System.out.println(input);

System.out.println(processed);

System.out.println(unprocessed);

}

}

} catch (Exception e) {

e.printStackTrace();

}

}

// this code is working properly but I have used a path like this

File configFile= new File("src\\config.xml");

Instead of system directory path I have to use path inside of project

but I am getting an error-cannot find the specified file

Please suggest me a proper solution

More Afsal cp's questions See All
Similar questions and discussions