package com.xml;
import java.io.File;
import org.dom4j.Document;
import org.dom4j.DocumentException;
import org.dom4j.io.SAXReader;
public class Dom4JReaderUtils {
private static final String RESOURCE;
static{
RESOURCE=Dom4JReaderUtils.class.getClassLoader().getResource("peopleList.xml").getPath();
}
public static Document getDocument(){
Document document=null;
SAXReader reader=new SAXReader();
try{
document=reader.read(new File(RESOURCE));
}catch(DocumentException e){
e.printStackTrace();
}
return document;
}
}
错误原因是
RESOURCE=Dom4JReaderUtils.class.getClassLoader().getResource("peopleList.xml").getPath();
Caused by: java.lang.NullPointerException
慕勒0069038
相关分类