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();
}
}
}
你解析了,可是没输出到控制台呢,看不到解析的信息的