[英]What am I doing wrong with my Dom4j Code?
大家好,我正在為我的項目加載類,該類從xml文件加載並提取信息。 我一直在網上關注一些指南,但是遇到了錯誤java.lang.NoClassDefFoundError:org / jaxen / JaxenException。 我知道代碼正在查找保存文件,因為我可以打印出名稱。 但是,當我嘗試提取信息時,我得到了該錯誤。 如果沒有錯誤,請在下面顯示代碼片段,讓我知道,我會發布更多內容。
public void LoadProjects()
{
try
{
Files.walk(Paths.get("D:/workspace/Project Program/Projects/")).forEach(filePath ->
{
if(Files.isRegularFile(filePath))
{
System.out.println("Testing");
try
{
SAXReader reader = new SAXReader();
Document document = reader.read(filePath.toFile());
System.out.println(document.getName());
Node node = document.selectSingleNode("///Project/Info");
//String name = node.valueOf("@Name");
//String projNum = node.valueOf("@ProjectNumber");
//node = document.selectSingleNode("//Project/Dates");
//String dueBy = node.valueOf("@DueBy");
//CButton temp = new CButton(name, projNum, dueBy);
//Console.console.AddToList(temp);
}
catch (Exception e)
{
e.printStackTrace();
}
}
});
}
catch(Exception e)
{
e.printStackTrace();
}
}
您是否將jaxen jar添加到服務器庫中?
到目前為止,您的代碼似乎正確,但請從一開始就添加盡可能多的信息。
如果您正在使用Maven:
<dependency>
<groupId>jaxen</groupId>
<artifactId>jaxen</artifactId>
<version>1.1.1</version>
</dependency>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.