public static void jdomReader() throws Exception { SAXBuilder builder = new SAXBuilder(); Document read_doc = builder.build(new File("F:/jdom_constant_config.xml")); Element root = read_doc.getRootElement(); //取得根节点 String a = root.getContent().get(0).getValue();//获得注释 String id = root.getAttribute("id").getValue(); // 获得属性id的值 System.out.println(id + "," + a); List list = root.getChildren("subTree"); for(int i=0;i"+obj1); System.out.println("object2=> "+obj2); System.out.println("object3=> "+obj3); System.out.println("---------------"); } }