Dom操作一
1 @Test 2 public void test() throws Exception{ 3 DocumentBuilderFactory fac = DocumentBuilderFactory.newInstance(); 4 DocumentBuilder db = fac.newDocumentBuilder(); 5 Document document = db.parse("src/1.xml"); 6 NodeList nl = document.getElementsByTagName("aaa"); 7 Node node = nl.item(0); 8 System.out.println(node.getChildNodes().getLength()); 9 }

浙公网安备 33010602011771号