qq_小树_6
2017-03-25 16:44
package java_13DOMtest;
import java.io.IOException;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import org.w3c.dom.Document;
import org.xml.sax.SAXException;
public class DomTest {
public static void main(String[] args) {
DocumentBuilderFactory dbf=DocumentBuilderFactory.newInstance();
try {
DocumentBuilder db=dbf.newDocumentBuilder();
Document document =db.parse("books.xml");
}
catch (SAXException | IOException e) {
e.printStackTrace();}
catch (ParserConfigurationException e) {
e.printStackTrace();
}
}
}
你解析了,可是没输出到控制台呢,看不到解析的信息的
Java眼中的XML---文件读取
83199 学习 · 431 问题
相似问题