運行後出現異常
運行後顯示的異常如下,請問怎麼處理呢?
Error occurred during initialization of boot layer
java.lang.module.ResolutionException: Module jaxen contains package org.w3c.dom, module java.xml exports package org.w3c.dom to jaxen
package com.imooc.dom4j.te;
相关代码:
import java.util.List;
import org.dom4j.Document;
import org.dom4j.DocumentException;
import org.dom4j.Element;
import org.dom4j.Node;
import org.dom4j.io.SAXReader;
public class XPathTesttor {
public void xpath(String xpathExp) {
String file="c:/workspace/xml/src/hr.xml";
SAXReader reader=new SAXReader();
try {
Document document=reader.read(file);
//執行Xpath表達式
//Node -可以查標籤Element 也可以查詢對象 Element的父類
List<Node> nodes=document.selectNodes(xpathExp);
for(Node node:nodes) {
Element emp=(Element)node;
System.out.println(emp.elementText("name"));
System.out.println(emp.elementText("age"));
System.out.println(emp.elementText("salary"));
}
} catch (DocumentException e) {
e.printStackTrace();
}
}
public static void main(String[] args) {
XPathTesttor testor=new XPathTesttor();
testor.xpath("/hr/employee");
}
}相关截图:

10
收起
正在回答 回答被采纳积分+1
java工程师2020版
- 参与学习 人
- 提交作业 9410 份
- 解答问题 16556 个
综合就业常年第一,编程排行常年霸榜,无需脱产即可学习,北上广深月薪过万 无论你是未就业的学生还是想转行的在职人员,不需要基础,只要你有梦想,想高薪
了解课程




恭喜解决一个难题,获得1积分~
来为老师/同学的回答评分吧
0 星