InputStream in; try { in = test.class.getClassLoader().getResourceAsStream("config/ipnetOracle.properties");//配置文件的路径 Properties p = new Properties(); p.load(in); String a = p.getProperty("chirdSystem");//chirdSystem为配置文件中的key System.out.println(a); } catch (IOException e) { e.printStackTrace(); }
File f = new File("data.xml"); DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = factory.newDocumentBuilder(); Document doc = builder.parse(f); NodeList nl = doc.getElementsByTagName("VALUE"); for (int i = 0; i < nl.getLength(); i++) { System.out.print("号码:"+ doc.getElementsByTagName("NO").item(i).getFirstChild().getNodeValue()); System.out.println("地址:"+ doc.getElementsByTagName("ADDR").item(i).getFirstChild().getNodeValue());
0票
开心
0票
板砖
0票
感动
0票
有用
0票
疑问
0票
难过
0票
无聊
0票
震惊
顶
踩