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));
}
}
Aggregations