DateUtil dd = new DateUtil();
String path = dd.getClass().getResource("/").getPath();
File _file = new File(path + File.separator + "com"+File.separator+"sixmanager" + File.separator +"common"+ File.separator+"MailConfig.xml");
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder domParser = factory.newDocumentBuilder();
Document document = domParser.parse(_file);
Node rootNode = document.getDocumentElement();//root为mail是对的
NodeList nodes = rootNode.getChildNodes();
for (int i = 0; i < nodes.getLength(); i++) {
if(nodes.item(i).getNodeName().equals("property")){//加个判断是为了去掉来历不明的空格,还有各种方法
System.out.println(nodes.item(i).getAttributes().getNamedItem("value").getNodeValue());
System.out.println(nodes.item(i).getAttributes().getNamedItem("name").getNodeValue());
}
}
String path = dd.getClass().getResource("/").getPath();
File _file = new File(path + File.separator + "com"+File.separator+"sixmanager" + File.separator +"common"+ File.separator+"MailConfig.xml");
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder domParser = factory.newDocumentBuilder();
Document document = domParser.parse(_file);
Node rootNode = document.getDocumentElement();//root为mail是对的
NodeList nodes = rootNode.getChildNodes();
for (int i = 0; i < nodes.getLength(); i++) {
if(nodes.item(i).getNodeName().equals("property")){//加个判断是为了去掉来历不明的空格,还有各种方法
System.out.println(nodes.item(i).getAttributes().getNamedItem("value").getNodeValue());
System.out.println(nodes.item(i).getAttributes().getNamedItem("name").getNodeValue());
}
}