DocumentBuilderFactory中的错误fact = new DocumentBuilderFactory.newInstance();?

时间:2017-10-05 18:31:33

标签: java itext

它声明DocumentBuilderFactory.newInstance无法解析为某个类型。 以下是代码:

 public static void replaceXfaStream(String src, String xml, String dest) throws IOException, DocumentException,        
       ParserConfigurationException, SAXException {

    PdfReader pdfReader = new PdfReader(src);
    PdfStamper pdfStamper = new PdfStamper(pdfReader,
                                  new FileOutputStream(dest));
    pdfStamper.getWriter().setPdfVersion(PdfWriter.VERSION_1_7);
    XfaForm xfa = new XfaForm(pdfReader);
    DocumentBuilderFactory fact = new DocumentBuilderFactory.newInstance();
    fact.setNamespaceAware(true);
    DocumentBuilder db = fact.newDocumentBuilder();
    Document doc = db.parse(new FileInputStream(xml));
    xfa.setDomDocument(doc);
    xfa.setChanged(true);
    XfaForm.setXfa(xfa, pdfStamper.getReader(), pdfStamper.getWriter());
    pdfStamper.close();

}

非常感谢!

0 个答案:

没有答案