public class Demo4 {
public static void main(String[] args) throws Exception {
SAXReader reader = new SAXReader();
Document document = reader.read(new File("src/book.xml"));
String value = document.selectSingleNode("//作者").getText();
System.out.println(value);
}
}
提取具体东西时,可以查看xpath文档,了解提取路径