</filePath>
</root>
java 代码
public static void main(String[] args) throws Exception{
SAXBuilder builder = new SAXBuilder();
File xmlFile = new File("c:/config.xml");
Document doc = builder.build(xmlFile);
Element root = doc.getRootElement();
//根路径
Element element = root.getChild("rootPath");
System.out.println(element.getAttributeValue("name"));
//rar命令路径
element = root.getChild("rarPath");
System.out.println(element.getText());
//zip压缩文件密码
element = root.getChild("zipPass");
System.out.println(element.getText());
//日志文件路径
element = root.getChild("filePath");
List
for (Element e : elementList) {
System.out.println(e.getAttributeValue("name"));
}
}