dom4j加载xml文件,生成Document

import java.io.File;

import org.dom4j.Document;
import org.dom4j.io.SAXReader;
import org.dom4j.DocumentException;

...
		Document document = null;
		File file = new File("D:\\sample.xml");
		SAXReader reader = new SAXReader();
		try {
			document = reader.read(file);
		} catch (DocumentException e1) {
			e1.printStackTrace();
		}
...

你可能感兴趣的:(java,xml)