• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java AutoPilot类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.ximpleware.AutoPilot的典型用法代码示例。如果您正苦于以下问题:Java AutoPilot类的具体用法?Java AutoPilot怎么用?Java AutoPilot使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



AutoPilot类属于com.ximpleware包,在下文中一共展示了AutoPilot类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: editPlugindata

import com.ximpleware.AutoPilot; //导入依赖的package包/类
private void editPlugindata(PluginConfigBean bean) {
	VTDGen vg = new VTDGen();
	vg.parseFile(pluginXmlLocation, true);
	VTDNav vn = vg.getNav();
	AutoPilot ap = new AutoPilot(vn);
	try {
		ap.selectXPath(manage.buildXpath(curPluginBean));
		XMLModifier xm = new XMLModifier(vn);
		while (ap.evalXPath() != -1) {
			xm.remove();
			xm.insertAfterElement(manage.buildPluginData(bean));
			manage.updataPluginMenu(bean);
		}
		FileOutputStream fos = new FileOutputStream(pluginXmlLocation);
		BufferedOutputStream bos = new BufferedOutputStream(fos);
		xm.output(bos); // 写入文件
		bos.close();
		fos.close();
	} catch (Exception e) {
		LOGGER.error("", e);
	}
}
 
开发者ID:heartsome,项目名称:translationstudio8,代码行数:23,代码来源:PluginConfigManageDialog.java


示例2: validateSplitedXlf

import com.ximpleware.AutoPilot; //导入依赖的package包/类
/**
 * 验证该文件是否是分割后的文件 robert 2012-06-09
 * @param xlfPath
 * @return
 */
public boolean validateSplitedXlf(String xlfPath) {
	VTDNav vn = vnMap.get(xlfPath);
	Assert.isNotNull(vn, Messages.getString("file.XLFHandler.msg4") + xlfPath);
	AutoPilot ap = new AutoPilot(vn);
	try {
		String xpath = "/xliff/file/header/hs:splitInfos";
		ap.selectXPath(xpath);
		while (ap.evalXPath() != -1) {
			return false;
		}
	} catch (Exception e) {
		LOGGER.error("", e);
		e.printStackTrace();
	}

	return true;
}
 
开发者ID:heartsome,项目名称:tmxeditor8,代码行数:23,代码来源:XLFHandler.java


示例3: testGetCurrentElementAttributs1Param

import com.ximpleware.AutoPilot; //导入依赖的package包/类
@Test
public void testGetCurrentElementAttributs1Param() throws XPathParseException, XPathEvalException, NavException{
	AutoPilot ap = new AutoPilot(vn);
	ap.selectXPath("//trans-unit[position()=2]");
	ap.evalXPath();
	
	Hashtable<String,String> eAtts = new Hashtable<String,String>();
	eAtts.put("approved","yes");
	eAtts.put("id","1");
	eAtts.put("merged-trans","yes");
	eAtts.put("reformat","yes");
	eAtts.put("size-unit","pixel");
	eAtts.put("translate","yes");
	eAtts.put("xml:space","preserve");
	eAtts.put("hs:ext","yes");
	eAtts.put("xsi:test", "test");
	
	Hashtable<String,String> aAtts = vu.getCurrentElementAttributs("es","http://www.heartsome.net.cn/2008/XLFExtension");
	assertEquals(eAtts,aAtts);
}
 
开发者ID:heartsome,项目名称:translationstudio8,代码行数:21,代码来源:VTDUtilsTest.java


示例4: getTransUnitContext

import com.ximpleware.AutoPilot; //导入依赖的package包/类
/**
 * 通过rowId获取当前翻译单元的上下文
 * @param rowId 
 * @param num 上下文个数
 * @return ;
 */
public Map<String, String> getTransUnitContext(String rowId, int num) {

	Map<String, String> result = new HashMap<String, String>();
	if (tuSizeMap == null || rowId == null) {
		return null;
	}

	VTDUtils vu = null;
	VTDNav vn = getVTDNavByRowId(rowId);
	try {
		vu = new VTDUtils(vn);
	} catch (NavException e1) {
		String errorMsg = Messages.getString("qa.QAXmlHandler.logger21");
		logger.error(errorMsg, e1);
		return null;
	}
	AutoPilot ap = new AutoPilot(vu.getVTDNav());
	result.put("x-preContext", getContext(vu, ap, num, true));
	result.put("x-nextContext", getContext(vu, ap, num, false));
	return result;
}
 
开发者ID:heartsome,项目名称:tmxeditor8,代码行数:28,代码来源:QAXmlHandler.java


示例5: description

import com.ximpleware.AutoPilot; //导入依赖的package包/类
private String description(VTDNav navigator) throws Exception 
{ AutoPilot pilot = new AutoPilot(navigator);
           
  navigator.push();
  
  try
     { pilot.selectXPath(DESCRIPTION);
  
       if (pilot.evalXPath() != -1)
          { return text(navigator);
          }
     }
  finally
     { navigator.pop();
     }

  return "";
}
 
开发者ID:twystd,项目名称:tbxml-android,代码行数:19,代码来源:VTDXPath.java


示例6: getCells

import com.ximpleware.AutoPilot; //导入依赖的package包/类
public List<Cell> getCells(String dataType) throws InternalFileException {
	cellList = new ArrayList<Cell>();
	String xpath = "/worksheet/sheetData/row/c[@t='" + dataType + "']";
	AutoPilot ap = new AutoPilot(vu.getVTDNav());
	try {
		ap.selectXPath(xpath);
		while (ap.evalXPath() != -1) {
			Hashtable<String, String> attrs = vu.getCurrentElementAttributs();
			SpreadsheetUtil.assertNull(attrs);
			String styleIndex = attrs.get("s");
			styleIndex = styleIndex == null ? "-1" : styleIndex;
			String val = vu.getChildContent("v");
			val = val == null ? "" : val;
			Cell cell = new Cell(val, Integer.parseInt(styleIndex), dataType);
			cellList.add(cell);
		}
	} catch (VTDException e) {
		logger.error("", e);
	}
	return cellList;
}
 
开发者ID:heartsome,项目名称:translationstudio8,代码行数:22,代码来源:SheetPart.java


示例7: generateNewTuHsId

import com.ximpleware.AutoPilot; //导入依赖的package包/类
public String generateNewTuHsId(VTDUtils vu) {
	// String hsid = "1";
	AutoPilot ap = new AutoPilot(vu.getVTDNav());
	try {
		ap.selectXPath("/tmx/body/tu");
		int max = 0;
		while (ap.evalXPath() != -1) {
			String hsid = vu.getCurrentElementAttribut("hsid", "1");
			int id = Integer.parseInt(hsid);
			if (id > max) {
				max = id;
			}
		}
		return max + 1 + "";
	} catch (VTDException e) {
		LOGGER.error("", e);
	}
	return "1";
}
 
开发者ID:heartsome,项目名称:tmxeditor8,代码行数:20,代码来源:TmxLargeFileDataAccess.java


示例8: getNodeText

import com.ximpleware.AutoPilot; //导入依赖的package包/类
/**
 * 获取指定节点的值(针对节点值为文本段)
 * @param xmlPath
 * @param nodeXpath
 * @return ;
 */
public String getNodeText(String xmlPath, String nodeXpath, String defaultValue){
	String aspellCommand = "";
	VTDNav vn = vnMap.get(xmlPath);
	Assert.isNotNull(vn, Messages.getString("qa.QAXmlHandler.msg1") + xmlPath);
	AutoPilot ap = new AutoPilot(vn);
	
	try {
		ap.selectXPath(nodeXpath);
		if (ap.evalXPath() != -1) {
			int commandIndex = vn.getText();
			if (commandIndex != -1) {
				aspellCommand = vn.toString(commandIndex);
			}else {
				return defaultValue;
			}
		}else {
			return defaultValue;
		}
	} catch (Exception e) {
		e.printStackTrace();
		logger.error(Messages.getString("qa.QAXmlHandler.logger16"), e);
	}
	return aspellCommand;
}
 
开发者ID:heartsome,项目名称:tmxeditor8,代码行数:31,代码来源:QAXmlHandler.java


示例9: getNotes

import com.ximpleware.AutoPilot; //导入依赖的package包/类
private Vector<NoteBean> getNotes(VTDUtils vu) throws XPathEvalException, NavException, XPathParseException {
	Vector<NoteBean> notes = new Vector<NoteBean>();
	VTDNav vn = vu.getVTDNav();
	AutoPilot ap = new AutoPilot(vn);
	ap.declareXPathNameSpace("xml", VTDUtils.XML_NAMESPACE_URL);
	ap.declareXPathNameSpace(hsNSPrefix, hsR7NSUrl);
	ap.selectXPath("./note");
	while (ap.evalXPath() != -1) {
		NoteBean note = new NoteBean(vu.getElementContent());
		note.setLang(vu.getCurrentElementAttribut("xml:lang", null));
		note.setFrom(vu.getCurrentElementAttribut("from", null));
		note.setPriority(vu.getCurrentElementAttribut("priority", null));
		note.setAnnotates(vu.getCurrentElementAttribut("annotates", null));
		note.setApplyCurrent(vu.getCurrentElementAttribut("hs:apply-current", "Yes"));

		notes.add(0, note);
	}

	if (notes.isEmpty()) {
		notes = null;
	}

	return notes;
}
 
开发者ID:heartsome,项目名称:translationstudio8,代码行数:25,代码来源:XLFHandler.java


示例10: getAllAttributes

import com.ximpleware.AutoPilot; //导入依赖的package包/类
/**
 * 获取所有属性
 * @param vn
 * @return
 * @throws Exception
 *             ;
 */
private Map<String, String> getAllAttributes(VTDNav vn) throws Exception {
	vn.push();
	AutoPilot apAttributes = new AutoPilot(vn);
	Map<String, String> attributes = new HashMap<String, String>();
	apAttributes.selectXPath("./@*");
	int inx = -1;
	while ((inx = apAttributes.evalXPath()) != -1) {
		String name = vn.toString(inx);
		inx = vn.getAttrVal(name);
		String value = inx != -1 ? vn.toString(inx) : "";
		attributes.put(name, value);

	}
	vn.pop();
	return attributes;
}
 
开发者ID:heartsome,项目名称:tmxeditor8,代码行数:24,代码来源:TmxFileValidator.java


示例11: getRowIdByXpath

import com.ximpleware.AutoPilot; //导入依赖的package包/类
/**
 * 通过文件名,与给定的xpath获取某个特定的tu节点的rowId,备注,只返回第一个ROWID robert 2012-04-28
 * @param xlfPath
 * @param xpath
 * @return ;
 */
public String getRowIdByXpath(String xlfPath, String xpath) {
	VTDNav vn = vnMap.get(xlfPath);
	AutoPilot ap = new AutoPilot(vn);
	ap.declareXPathNameSpace("xml", VTDUtils.XML_NAMESPACE_URL);
	ap.declareXPathNameSpace(hsNSPrefix, hsR7NSUrl);
	try {
		ap.selectXPath(xpath);
		if (ap.evalXPath() != -1) {
			return RowIdUtil.getRowId(vn, xlfPath);
		}
	} catch (Exception e) {
		e.printStackTrace();
	}
	return null;
}
 
开发者ID:heartsome,项目名称:translationstudio8,代码行数:22,代码来源:XLFHandler.java


示例12: getNodePureText

import com.ximpleware.AutoPilot; //导入依赖的package包/类
/**
 * 获取一个节点的纯文本,将所有的标记除外,包括标记里面的内容
 * @return
 */
public String getNodePureText(String xlfPath, String nodeXpath){
	String pureText = "";
	VTDNav vn = vnMap.get(xlfPath);
	AutoPilot ap = apMap.get(xlfPath);
	validNull(vn, ap, xlfPath);
	try {
		VTDUtils vUtils = new VTDUtils(vn);
		ap.selectXPath(nodeXpath);
		while (ap.evalXPath() != -1) {
			pureText = vUtils.getElementPureText();
		}
	} catch (Exception e) {
		e.printStackTrace();
		logger.error(Messages.getString("qa.QAXmlHandler.logger14"), e);
	}
	return pureText;
}
 
开发者ID:heartsome,项目名称:tmxeditor8,代码行数:22,代码来源:QAXmlHandler.java


示例13: getTuByIdentifier

import com.ximpleware.AutoPilot; //导入依赖的package包/类
public TmxTU getTuByIdentifier(String tuIdentifier) {
	VTDUtils vu = container.getVTDUtils();
	VTDNav vn = vu.getVTDNav();
	AutoPilot ap = new AutoPilot(vn);
	TmxTU tu = new TmxTU();
	try {
		String xp = xpath.replace("__id__", tuIdentifier + "");
		ap.selectXPath(xp);
		if (ap.evalXPath() != -1) {
			TmxFileDataAccessUtils.readTUAttr4VTDNav(vu, tu);
			TmxFileDataAccessUtils.readTUNote4VTDNav(vu, tu);
			TmxFileDataAccessUtils.readTUProp4VTDNav(vu, tu);
			TmxFileDataAccessUtils.readTUTuv4VTDNav(vu, tu, super.currSrcLang, super.currTgtLang);
		}
	} catch (VTDException e1) {
		e1.printStackTrace();
	}
	tu.setTmId(Integer.parseInt(tuIdentifier));
	return tu;
}
 
开发者ID:heartsome,项目名称:tmxeditor8,代码行数:21,代码来源:TmxFileDataAccess.java


示例14: getFileComments

import com.ximpleware.AutoPilot; //导入依赖的package包/类
/**
 * 获取sdl文件的全局批注。
 */
private void getFileComments() throws Exception{
	AutoPilot ap = new AutoPilot(sklVN);
	//无论有几个file节点,都获取所有的备注信息
	String xpath = "/xliff/file/header/sdl:cmt";
	ap.declareXPathNameSpace("sdl", "http://sdl.com/FileTypes/SdlXliff/1.0");
	ap.selectXPath(xpath);
	//sdl="http://sdl.com/FileTypes/SdlXliff/1.0"
	VTDUtils vu = new VTDUtils(sklVN);
	while(ap.evalXPath() != -1){
		if (sklVN.getAttrVal("id") != -1) {
			String commentId = sklVN.toString(sklVN.getAttrVal("id"));
			getSdlComment(sklVN, vu, commentId, null);
		}
	}
}
 
开发者ID:heartsome,项目名称:translationstudio8,代码行数:19,代码来源:Sdl2Xliff.java


示例15: deleteNodeProp

import com.ximpleware.AutoPilot; //导入依赖的package包/类
/**
 * 删除节点的属性
 * @param vu
 * @param ap
 * @param xm
 * @param rowId
 * @param subXPath
 * @throws XPathParseException
 * @throws XPathEvalException
 * @throws NavException
 * @throws ModifyException
 * @throws UnsupportedEncodingException
 *             ;
 */
private void deleteNodeProp(VTDUtils vu, AutoPilot ap, XMLModifier xm, String rowId, String subXPath)
		throws XPathParseException, XPathEvalException, NavException, ModifyException, UnsupportedEncodingException {
	ap.declareXPathNameSpace("xml", VTDUtils.XML_NAMESPACE_URL);
	ap.declareXPathNameSpace(hsNSPrefix, hsR7NSUrl);
	String tuXPath = RowIdUtil.parseRowIdToXPath(rowId); // 根据RowId得到定位到该翻译单元的XPath
	String propXpath = "." + subXPath; // 可以定位TU下的任何子节点属性
	if (vu.pilot(ap, tuXPath) != -1) { // 导航到 TU 节点
		AutoPilot aptemp = new AutoPilot(vu.getVTDNav());
		aptemp.declareXPathNameSpace("xml", VTDUtils.XML_NAMESPACE_URL);
		aptemp.declareXPathNameSpace(hsNSPrefix, hsR7NSUrl);
		aptemp.selectXPath(propXpath);
		if (aptemp.evalXPath() != -1) { // 这里如果没有Target节点就不做处理
			xm.removeAttribute(vu.getVTDNav().getCurrentIndex());
		}
	}
}
 
开发者ID:heartsome,项目名称:translationstudio8,代码行数:31,代码来源:XLFHandler.java


示例16: getTUFragByRowId

import com.ximpleware.AutoPilot; //导入依赖的package包/类
/**
 * 获取给定rowId的完整内容,包括头与尾
 * @param rowId
 * @return ;
 */
public String getTUFragByRowId(String rowId) {
	String nodeStr = null;
	String xlfPath = RowIdUtil.getFileNameByRowId(rowId);
	VTDNav vn = vnMap.get(xlfPath);
	Assert.isNotNull(vn, Messages.getString("file.XLFHandler.msg4") + xlfPath);

	String xpath = RowIdUtil.parseRowIdToXPath(rowId);
	AutoPilot ap = new AutoPilot(vn);
	try {
		VTDUtils vu = new VTDUtils(vn);
		ap.selectXPath(xpath);
		if (ap.evalXPath() != -1) {
			nodeStr = vu.getElementFragment();
		}
	} catch (Exception e) {
		LOGGER.error("", e);
		e.printStackTrace();
	}
	return nodeStr;
}
 
开发者ID:heartsome,项目名称:tmxeditor8,代码行数:26,代码来源:XLFHandler.java


示例17: getAspellDictionaries

import com.ximpleware.AutoPilot; //导入依赖的package包/类
/**
 * 获取aspell拼写检查器的词典语言
 * @param aspellConfigFile	aspell配置文件路径
 * @return ;
 */
public Hashtable<String, String> getAspellDictionaries(String aspellConfigFile) {
	Hashtable<String, String> dictionaries = new Hashtable<String, String>();
	VTDNav vn = vnMap.get(aspellConfigFile);
	Assert.isNotNull(vn, Messages.getString("qa.QAXmlHandler.msg1") + aspellConfigFile);

	try {
		AutoPilot ap = new AutoPilot(vn);
		ap.selectXPath("/aspell/aspellDictionaries/*");
		while (ap.evalXPath() != -1) {
			dictionaries.put(vn.toString(vn.getCurrentIndex()), vn.toString(vn.getText()));
		}
	} catch (Exception e) {
		e.printStackTrace();
		logger.error("", e);
	}
	return dictionaries;
}
 
开发者ID:heartsome,项目名称:tmxeditor8,代码行数:23,代码来源:QAXmlHandler.java


示例18: getNonTextContent

import com.ximpleware.AutoPilot; //导入依赖的package包/类
/**
 * Get rPh & phoneticPr Element fragment
 * @return ;
 */
private String getNonTextContent(){
	StringBuffer result = new StringBuffer();
	VTDGen vg = new VTDGen();
	vg.setDoc(content.getBytes());
	VTDUtils vu = null;
	try {
		vg.parse(true);
		vu = new VTDUtils(vg.getNav());

		AutoPilot ap = new AutoPilot(vu.getVTDNav());
		ap.selectXPath("/si/rPh | phoneticPr");
		while(ap.evalXPath() != -1){
			result.append(vu.getElementFragment());
		}			
	} catch (VTDException e) {
		e.printStackTrace();
	}
	return result.toString();
}
 
开发者ID:heartsome,项目名称:tmxeditor8,代码行数:24,代码来源:Cell.java


示例19: getSubNodePureText

import com.ximpleware.AutoPilot; //导入依赖的package包/类
/**
 * 获取ph,etp,btp,it节点下sub子节点的纯文本
 * //ph,etp,btp,it节点,只有其子节点sub内的文本才是翻译文本,故,去掉ph,etp,btp,it节点的纯文本
 * @param vn
 * @return
 */
public String getSubNodePureText(VTDNav vn){
	String subPureText = "";
	AutoPilot ap = new AutoPilot(vn);
	try {
		ap.selectXPath("./*");
		VTDUtils vUtils = new VTDUtils(vn);
		while (ap.evalXPath() != -1) {
			if (vUtils.getChildElementsCount() <= 0) {
				subPureText += " " + vUtils.getElementContent();
			}else {
				subPureText += " " + getTUPureText(vn);
			}
		}
	} catch (Exception e) {
		e.printStackTrace();
		logger.error(Messages.getString("qa.QAXmlHandler.logger14"), e);
	}
	return subPureText;
}
 
开发者ID:heartsome,项目名称:translationstudio8,代码行数:26,代码来源:QAXmlHandler.java


示例20: validateSplitedXlf

import com.ximpleware.AutoPilot; //导入依赖的package包/类
/**
 * 验证该文件是否是分割后的文件 robert 2012-06-09
 * @param xlfPath
 * @return
 */
public boolean validateSplitedXlf(String xlfPath) {
	VTDNav vn = vnMap.get(xlfPath);
	Assert.isNotNull(vn, Messages.getString("file.XLFHandler.msg4") + xlfPath);
	AutoPilot ap = new AutoPilot(vn);
	ap.declareXPathNameSpace("hs", hsR7NSUrl);
	try {
		String xpath = "/xliff/file/header/hs:splitInfos";
		ap.selectXPath(xpath);
		while (ap.evalXPath() != -1) {
			return false;
		}
	} catch (Exception e) {
		LOGGER.error("", e);
		e.printStackTrace();
	}

	return true;
}
 
开发者ID:heartsome,项目名称:translationstudio8,代码行数:24,代码来源:XLFHandler.java



注:本文中的com.ximpleware.AutoPilot类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java CompressAwarePath类代码示例发布时间:2022-05-22
下一篇:
Java LabelTextVar类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap