import ; import ; import .*; import .*; import ; import ; ..*; .; public class DOMConvert { public static void main(String[] args) { DocumentBuilderFactory dbf=(); try { DocumentBuilder db=(); Document doc=(new File("")); Element eltStu=("student"); Element eltName=("name"); Element eltAge=("age"); Text txtName=(" 王五"); Text txtAge=("19"); (txtName); (txtAge); (eltName); (eltAge); ("sn","03"); Element root=(); (eltStu); NodeList nl=("student"); ((0)); Element eltStuChg=(Element)(0); Node nodeAgeChg=("age").item(0); ().setNodeValue("22"); int len=(); for(int i=0;i<len;i++) { Element elt=(Element)(i); (" 编号: "+("sn")); Node nodeName=("name").item(0); Node nodeAge=("age").item(0); String name=().getNode
程序代码java 来自淘豆网m.daumloan.com转载请标明出处.