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文檔,了解提取路徑