问这个问题似乎很愚蠢。我对 jdbc 很陌生,并试图按照教程进行操作。本教程试图以“mapping.xml”提供的解析形式存储 XML 数据。下面是示例代码:
public static void main (String args[]) {
Document mapping = null;
Document dataDoc = null;
Document newDoc = null;
try {
DocumentBuilderFactory dbfactory = DocumentBuilderFactory.newInstance();
DocumentBuilder docbuilder = dbfactory.newDocumentBuilder();
mapping = docbuilder.parse("mapping.xml");
dataDoc = docbuilder.newDocument();
//Instantiate the new Document
newDoc = docbuilder.newDocument();
} catch (Exception e) {
System.out.println("Errors with creating document: "+e.getMessage());
}
但是,在运行代码之后,没有创建新的 XML 文档,也没有捕获到异常。谁能帮我吗?
谢谢!!