Search in sources :

Example 76 with XMLModifier

use of com.ximpleware.XMLModifier in project translationstudio8 by heartsome.

the class XLFHandler method deleteAltTrans.

/**
	 * 删除匹配
	 * @param xpath
	 *            alter-trans节点中的条件Xpath
	 */
public void deleteAltTrans(String xpath) {
    Map<String, List<String>> map = RowIdUtil.groupRowIdByFileName(rowIds);
    for (Entry<String, List<String>> entry : map.entrySet()) {
        try {
            VTDUtils vu = new VTDUtils(vnMap.get(entry.getKey()));
            xpath = XPATH_ALL_TU + "/alt-trans[" + xpath + "]";
            XMLModifier xm = vu.delete(xpath, VTDUtils.PILOT_TO_END);
            saveAndReparse(xm, entry.getKey());
        } catch (NavException e) {
            LOGGER.error("", e);
            e.printStackTrace();
        }
    }
}
Also used : XMLModifier(com.ximpleware.XMLModifier) VTDUtils(net.heartsome.xml.vtdimpl.VTDUtils) NavException(com.ximpleware.NavException) List(java.util.List) ArrayList(java.util.ArrayList) LinkedList(java.util.LinkedList)

Aggregations

XMLModifier (com.ximpleware.XMLModifier)76 NavException (com.ximpleware.NavException)52 VTDNav (com.ximpleware.VTDNav)49 ModifyException (com.ximpleware.ModifyException)48 AutoPilot (com.ximpleware.AutoPilot)46 VTDUtils (net.heartsome.xml.vtdimpl.VTDUtils)41 XPathParseException (com.ximpleware.XPathParseException)40 XPathEvalException (com.ximpleware.XPathEvalException)39 IOException (java.io.IOException)35 TranscodeException (com.ximpleware.TranscodeException)32 UnsupportedEncodingException (java.io.UnsupportedEncodingException)22 VTDGen (com.ximpleware.VTDGen)19 CoreException (org.eclipse.core.runtime.CoreException)17 FileNotFoundException (java.io.FileNotFoundException)15 ParseException (com.ximpleware.ParseException)13 OperationCanceledException (org.eclipse.core.runtime.OperationCanceledException)13 ArrayList (java.util.ArrayList)12 FileOutputStream (java.io.FileOutputStream)11 XQException (javax.xml.xquery.XQException)11 File (java.io.File)10