Search in sources :

Example 1 with DocxConverterException

use of net.heartsome.cat.converter.word2007.common.DocxConverterException in project translationstudio8 by heartsome.

the class PartOperate method loadFile.

/**
	 * 解析文件
	 * @param nameSpaceMap	要申明的命名空间
	 * @throws Exception
	 */
protected void loadFile(Map<String, String> nameSpaceMap) throws Exception {
    VTDGen vg = new VTDGen();
    if (vg.parseFile(partPath, true)) {
        vn = vg.getNav();
        ap = new AutoPilot(vn);
        otherAP = new AutoPilot(vn);
        childAP = new AutoPilot(vn);
        extendAP = new AutoPilot(vn);
        vu = new VTDUtils(vn);
        xm = new XMLModifier(vn);
        // 给 ap 申明命名空间
        for (Entry<String, String> entry : nameSpaceMap.entrySet()) {
            ap.declareXPathNameSpace(entry.getKey(), entry.getValue());
            childAP.declareXPathNameSpace(entry.getKey(), entry.getValue());
            otherAP.declareXPathNameSpace(entry.getKey(), entry.getValue());
            extendAP.declareXPathNameSpace(entry.getKey(), entry.getValue());
        }
    } else {
        throw new DocxConverterException(MessageFormat.format(Messages.getString("docxConvert.msg2"), partPath));
    }
}
Also used : XMLModifier(com.ximpleware.XMLModifier) VTDUtils(net.heartsome.xml.vtdimpl.VTDUtils) DocxConverterException(net.heartsome.cat.converter.word2007.common.DocxConverterException) AutoPilot(com.ximpleware.AutoPilot) VTDGen(com.ximpleware.VTDGen)

Aggregations

AutoPilot (com.ximpleware.AutoPilot)1 VTDGen (com.ximpleware.VTDGen)1 XMLModifier (com.ximpleware.XMLModifier)1 DocxConverterException (net.heartsome.cat.converter.word2007.common.DocxConverterException)1 VTDUtils (net.heartsome.xml.vtdimpl.VTDUtils)1