com.ximpleware.VTDGen Java Examples
The following examples show how to use
com.ximpleware.VTDGen.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TSFileHandler.java From translationstudio8 with GNU General Public License v2.0 | 6 votes |
public static void main(String[] args) throws XPathParseException, XPathEvalException, NavException { TSFileHandler ts = new TSFileHandler(); VTDGen vg = new VTDGen(); if (vg .parseFile( "/data/john/Workspaces/Other/net.heartsome.cat.ts.core/testSrc/net/heartsome/cat/ts/core/file/test/Test.txt.xlf", true)) { ts.openFile("/data/john/Workspaces/Other/net.heartsome.cat.ts.core/testSrc/net/heartsome/cat/ts/core/file/test/Test.txt.xlf"); System.out.println(ts.getSourceLanguage(3)); System.out.println(ts.getTargetLanguage(3)); // System.out // .println(ts // .analysisTranslatorProgress( // vg.getNav(), // "/data/john/Workspaces/Other/net.heartsome.cat.ts.core/testSrc/net/heartsome/cat/ts/core/file/test/Test.txt.xlf", // 0)); } }
Example #2
Source File: XLIFF2PPTX.java From tmxeditor8 with GNU General Public License v2.0 | 6 votes |
/** * 解析 XLIFF 文件,获取所有文本段集合 * @throws NavException * @throws XPathParseException * @throws XPathEvalException */ private void loadSegment() throws NavException, XPathParseException, XPathEvalException { VTDGen vg = new VTDGen(); if (vg.parseFile(strXLIFFPath, true)) { VTDNav vn = vg.getNav(); VTDUtils vu = new VTDUtils(vn); AutoPilot ap = new AutoPilot(vn); ap.selectXPath("/xliff/file/body//trans-unit"); while (ap.evalXPath() != -1) { String strTuId = vu.getCurrentElementAttribut("id", null); String strSource = vu.getElementContent("./source"); String strTarget = vu.getElementContent("./target"); mapSegment.put(strTuId, new String[] { strSource, strTarget }); } } }
Example #3
Source File: Mq2Xliff.java From translationstudio8 with GNU General Public License v2.0 | 6 votes |
/** * 将mq 的骨架文件拷到R8 的骨架文件中 * @throws Exception */ private void copyMqSklToHsSkl(File mqSkeletonFile) throws Exception { VTDGen vg = new VTDGen(); AutoPilot ap = new AutoPilot(); String mqSklContent = ""; String xpath = "/mq:externalparts"; if(vg.parseFile(mqSkeletonFile.getAbsolutePath(), true)){ VTDNav vn = vg.getNav(); ap.bind(vn); VTDUtils vu = new VTDUtils(vn); ap.declareXPathNameSpace("mq", "MemoQ Xliff external parts"); ap.selectXPath(xpath); if (ap.evalXPath() != -1) { mqSklContent = vu.getElementContent(); } } //下面添加到 r8 的骨架文件中去 ap.bind(sklVN); xpath = "/xliff/file/header/skl"; ap.selectXPath(xpath); if (ap.evalXPath() != -1) { sklXM.insertAfterElement("<sklContent>" + mqSklContent + "</sklContent>"); sklXM.output(skeletonFile); } }
Example #4
Source File: PartOperate.java From translationstudio8 with GNU General Public License v2.0 | 6 votes |
/** * 解析文件 * @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)); } }
Example #5
Source File: PluginConfigManageDialog.java From translationstudio8 with GNU General Public License v2.0 | 6 votes |
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); } }
Example #6
Source File: AbstractVersionModifyingMojo.java From revapi with Apache License 2.0 | 6 votes |
void updateProjectParentVersion(MavenProject project, Version version) throws MojoExecutionException { try { VTDGen gen = new VTDGen(); gen.enableIgnoredWhiteSpace(true); gen.parseFile(project.getFile().getAbsolutePath(), true); VTDNav nav = gen.getNav(); AutoPilot ap = new AutoPilot(nav); ap.selectXPath("namespace-uri(.)"); String ns = ap.evalXPathToString(); nav.toElementNS(VTDNav.FIRST_CHILD, ns, "parent"); nav.toElementNS(VTDNav.FIRST_CHILD, ns, "version"); int pos = nav.getText(); XMLModifier mod = new XMLModifier(nav); mod.updateToken(pos, version.toString()); try (OutputStream out = new FileOutputStream(project.getFile())) { mod.output(out); } } catch (IOException | ModifyException | NavException | XPathParseException | TranscodeException e) { throw new MojoExecutionException("Failed to update the parent version of project " + project, e); } }
Example #7
Source File: PartOperate.java From tmxeditor8 with GNU General Public License v2.0 | 6 votes |
/** * 解析文件 * @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)); } }
Example #8
Source File: Cell.java From translationstudio8 with GNU General Public License v2.0 | 6 votes |
/** * 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(); }
Example #9
Source File: VTDUtils.java From tmxeditor8 with GNU General Public License v2.0 | 6 votes |
/** * 获得整个节点的段落 * @return 整个节点的段落,例如:<ph id="1">a</ph> * @throws NavException * ; */ public String getElementFragment() throws NavException { long l = vn.getElementFragment(); int offset = (int) l; int len = (int) (l >> 32); /* 区别编码。在解析 UTF-16 等部分编码的时候索引会变为2倍。 */ if (vn.getEncoding() > VTDGen.FORMAT_WIN_1258) { offset = offset >> 1; len = len >> 1; } // 处理这种情况下获取内容错误的情况 <ph>...</ph> 1><ph>...</ph> robert 2012-09-13 String fragment = vn.toRawString(offset, len); int length = fragment.length(); int realEndIdx = fragment.indexOf(">", fragment.lastIndexOf("<")); if (realEndIdx != length - 1) { fragment = fragment.substring(0, fragment.indexOf(">", fragment.lastIndexOf("<")) + 1); } return fragment; }
Example #10
Source File: TSFileHandler.java From tmxeditor8 with GNU General Public License v2.0 | 6 votes |
public static void main(String[] args) throws XPathParseException, XPathEvalException, NavException { TSFileHandler ts = new TSFileHandler(); VTDGen vg = new VTDGen(); if (vg .parseFile( "/data/john/Workspaces/Other/net.heartsome.cat.ts.core/testSrc/net/heartsome/cat/ts/core/file/test/Test.txt.xlf", true)) { ts.openFile("/data/john/Workspaces/Other/net.heartsome.cat.ts.core/testSrc/net/heartsome/cat/ts/core/file/test/Test.txt.xlf"); System.out.println(ts.getSourceLanguage(3)); System.out.println(ts.getTargetLanguage(3)); // System.out // .println(ts // .analysisTranslatorProgress( // vg.getNav(), // "/data/john/Workspaces/Other/net.heartsome.cat.ts.core/testSrc/net/heartsome/cat/ts/core/file/test/Test.txt.xlf", // 0)); } }
Example #11
Source File: XLIFF2PPTX.java From translationstudio8 with GNU General Public License v2.0 | 6 votes |
/** * 解析 XLIFF 文件,获取所有文本段集合 * @throws NavException * @throws XPathParseException * @throws XPathEvalException */ private void loadSegment() throws NavException, XPathParseException, XPathEvalException { VTDGen vg = new VTDGen(); if (vg.parseFile(strXLIFFPath, true)) { VTDNav vn = vg.getNav(); VTDUtils vu = new VTDUtils(vn); AutoPilot ap = new AutoPilot(vn); ap.selectXPath("/xliff/file/body//trans-unit"); while (ap.evalXPath() != -1) { String strTuId = vu.getCurrentElementAttribut("id", null); String strSource = vu.getElementContent("./source"); String strTarget = vu.getElementContent("./target"); mapSegment.put(strTuId, new String[] { strSource, strTarget }); } } }
Example #12
Source File: Xliff2Ttx.java From tmxeditor8 with GNU General Public License v2.0 | 6 votes |
/** * 根据一个<g>标记的头部获取标记的 id 属性值 * @param tagStr * @return */ private String getTagId(String tagStr) throws Exception { String tagId = ""; VTDGen vg = new VTDGen(); vg.setDoc(tagStr.getBytes()); vg.parse(false); VTDNav vn = vg.getNav(); tagAP = new AutoPilot(vn); tagAP.selectXPath("/g"); int index = -1; if (tagAP.evalXPath() != -1) { if ((index = vn.getAttrVal("id")) != -1) { tagId = vn.toRawString(index); } } return tagId; }
Example #13
Source File: TmxFileValidator.java From tmxeditor8 with GNU General Public License v2.0 | 5 votes |
private VTDGen repair() throws IOException { // 文档错误 printlnInfo(split); printlnWarning(MessageFormat.format(Messages.getString("tmxeditor.tmxFileValidator.parseError.msg"), tmxLocation)); TmxScanner scanner = new TmxScanner(tmxLocation); scanner.setProgressBar(progressBar); StringBuilder error = null; while (!scanner.isFinish()) { if (scanner.scanTmxDocument() == null) { for (ErrorDescription errordes : scanner.errorFIFO) { error = new StringBuilder(); error.append("[ line : ").append(errordes.lineNumber).append(" ]").append(errordes.description); printlnError(error.toString()); } } } tmxLocation = scanner.scanTmxDocument(); Display.getDefault().asyncExec(new Runnable() { @Override public void run() { progressBar.setSelection(100); } }); try { File file = new File(tmxLocation); if (file.exists()) { return VTDLoader.loadVTDGen(file, FileEncodingDetector.detectFileEncoding(new File(tmxLocation))); } return null; } catch (Exception e) { scanner.clear(); printError(Messages.getString("tmxeditor.tmxFileValidator.autofix.failure")); return null; } }
Example #14
Source File: TmxFileValidator.java From tmxeditor8 with GNU General Public License v2.0 | 5 votes |
/** * 解析TMX文件 ; */ private boolean parseXML(String xmlLocation) { VTDGen vg = new VTDGen(); boolean result = vg.parseFile(xmlLocation, true); if (result) { VTDNav vtdNav = vg.getNav(); vnMap.put(xmlLocation, vtdNav); } return result; }
Example #15
Source File: Xliff2Ttx.java From tmxeditor8 with GNU General Public License v2.0 | 5 votes |
/** * 解析要被逆转换的xliff文件 * @param xliffFile * @throws Exception */ private void parseXlfFile(String xliffFile) throws Exception { VTDGen vg = new VTDGen(); if (vg.parseFile(xliffFile, true)) { xlfVN = vg.getNav(); xlfAP = new AutoPilot(xlfVN); }else { String errorInfo = MessageFormat.format("文件 {0} 的骨架信息无法解析,逆转换失败!", new Object[]{new File(xliffFile).getName()}); throw new Exception(errorInfo); } }
Example #16
Source File: XliffInputer.java From tmxeditor8 with GNU General Public License v2.0 | 5 votes |
/** * 解析 hsxliff 文件 * @throws Exception */ private void loadXliff() throws Exception { VTDGen vg = new VTDGen(); if (vg.parseFile(xliffFile, true)) { vn = vg.getNav(); ap = new AutoPilot(vn); childAP = new AutoPilot(vn); ap.declareXPathNameSpace("hs", "http://www.heartsome.net.cn/2008/XLFExtension"); childAP.declareXPathNameSpace("hs", "http://www.heartsome.net.cn/2008/XLFExtension"); vu = new VTDUtils(vn); }else { throw new Exception(MessageFormat.format(Messages.getString("docxConvert.msg2"), xliffFile)); } }
Example #17
Source File: XLPHandler.java From tmxeditor8 with GNU General Public License v2.0 | 5 votes |
/** * 打开 XLP 文件 * @param xlpPath * XLP 文件路径 * @return ; */ private VTDNav openFile(String xlpPath) { VTDGen vg = new VTDGen(); if (vg.parseFile(xlpPath, true)) { return vg.getNav(); } else { String errorMsg = MessageFormat.format(Messages.getString("file.XLPHandler.logger1"), xlpPath); LOGGER.error(errorMsg); return null; } }
Example #18
Source File: QAXmlHandler.java From tmxeditor8 with GNU General Public License v2.0 | 5 votes |
protected boolean saveAndReparse(XMLModifier xm, String fileName) { boolean isSaved = save(xm, fileName); if (!isSaved) { logger.debug(Messages.getString("qa.QAXmlHandler.logger3")); return false; } // 重新加载 VTDGen vg = new VTDGen(); if (vg.parseFile(fileName, true)) { vnMap.put(fileName, vg.getNav()); return true; } return false; }
Example #19
Source File: Wf2Xliff.java From translationstudio8 with GNU General Public License v2.0 | 5 votes |
/** * 解析骨架文件,此时的骨架文件的内容就是源文件的内容 * @throws Exception */ private void parseSkeletonFile() throws Exception{ String errorInfo = ""; VTDGen vg = new VTDGen(); if (vg.parseFile(skeletonFile, true)) { sklVN = vg.getNav(); sklXM = new XMLModifier(sklVN); }else { errorInfo = MessageFormat.format(Messages.getString("wf.parse.msg1"), new Object[]{new File(inputFile).getName()}); throw new Exception(errorInfo); } }
Example #20
Source File: Xliff2Ttx.java From translationstudio8 with GNU General Public License v2.0 | 5 votes |
/** * 解析结果文件(解析时这个结果文件还是一个骨架文件) * @param file * @throws Exception */ private void parseOutputFile(String file, String xliffFile) throws Exception { VTDGen vg = new VTDGen(); if (vg.parseFile(file, true)) { outputVN = vg.getNav(); outputXM = new XMLModifier(outputVN); outputAP = new AutoPilot(outputVN); outputVU = new VTDUtils(outputVN); }else { String errorInfo = MessageFormat.format("文件 {0} 的骨架信息无法解析,逆转换失败!", new Object[]{new File(xliffFile).getName()}); throw new Exception(errorInfo); } }
Example #21
Source File: TMXValidator.java From tmxeditor8 with GNU General Public License v2.0 | 5 votes |
/** * 解析TMX文件 ; */ private boolean parseXML(String xmlLocation){ VTDGen vg = new VTDGen(); boolean result = vg.parseFile(xmlLocation, true); if (result) { VTDNav vtdNav = vg.getNav(); vnMap.put(xmlLocation, vtdNav); } return result; }
Example #22
Source File: TmxFileContainer.java From tmxeditor8 with GNU General Public License v2.0 | 5 votes |
/** * Parse current TMX file with VTD * @return <code>VTDUtils<code> * @throws Exception * A set of VTD parse exception; */ public void parseFileWithVTD() throws Exception { File f = new File(this.filePath); if (!f.exists() || f.isDirectory()) { throw new FileNotFoundException(Messages.getString("tmxdata.TmxFileContainer.parseTmxFileNotFound")); } VTDGen vg = parseFile(f); vu = new VTDUtils(vg.getNav()); loadTmxHeader(vu); getTUIndexCache(true); vg.clear(); }
Example #23
Source File: Xliff2Mq.java From translationstudio8 with GNU General Public License v2.0 | 5 votes |
/** * 解析要被逆转换的xliff文件 * @param xliffFile * @throws Exception */ private void parseXlfFile(String xliffFile) throws Exception { VTDGen vg = new VTDGen(); if (vg.parseFile(xliffFile, true)) { xlfVN = vg.getNav(); }else { String errorInfo = MessageFormat.format(Messages.getString("mq.parse.msg1"), new Object[]{new File(xliffFile).getName()}); throw new Exception(errorInfo); } }
Example #24
Source File: Mq2Xliff.java From translationstudio8 with GNU General Public License v2.0 | 5 votes |
/** * 解析R8 的骨架文件 * @throws Exception */ private void parseHSSkeletonFile() throws Exception { String errorInfo = ""; VTDGen vg = new VTDGen(); if (vg.parseFile(skeletonFile, true)) { sklVN = vg.getNav(); sklXM = new XMLModifier(sklVN); }else { errorInfo = MessageFormat.format(Messages.getString("mq.parse.msg1"), new Object[]{new File(inputFile).getName()}); throw new Exception(errorInfo); } }
Example #25
Source File: Xliff2Sdl.java From translationstudio8 with GNU General Public License v2.0 | 5 votes |
/** * 解析要被逆转换的xliff文件 * @param xliffFile * @throws Exception */ private void parseXlfFile(String xliffFile) throws Exception { VTDGen vg = new VTDGen(); if (vg.parseFile(xliffFile, true)) { xlfVN = vg.getNav(); }else { String errorInfo = MessageFormat.format(Messages.getString("sdl.parse.msg1"), new Object[]{new File(xliffFile).getName()}); throw new Exception(errorInfo); } }
Example #26
Source File: Xliff2Sdl.java From translationstudio8 with GNU General Public License v2.0 | 5 votes |
/** * 解析结果文件(解析时这个结果文件还是一个骨架文件) * @param file * @throws Exception */ private void parseOutputFile(String file, String xliffFile) throws Exception { VTDGen vg = new VTDGen(); if (vg.parseFile(file, true)) { outputVN = vg.getNav(); outputXM = new XMLModifier(outputVN); outputAP = new AutoPilot(outputVN); outputAP.declareXPathNameSpace("sdl", "http://sdl.com/FileTypes/SdlXliff/1.0"); }else { String errorInfo = MessageFormat.format(Messages.getString("sdl.parse.msg2"), new Object[]{new File(xliffFile).getName()}); throw new Exception(errorInfo); } }
Example #27
Source File: Sdl2Xliff.java From translationstudio8 with GNU General Public License v2.0 | 5 votes |
/** * 解析骨架文件,此时的骨架文件的内容就是源文件的内容 * @throws Exception */ private void parseSkeletonFile() throws Exception{ // String errorInfo = ""; VTDGen vg = VTDLoader.loadVTDGen(new File(skeletonFile), "UTF-8"); // if (vg.parseFile(skeletonFile, true)) { sklVN = vg.getNav(); sklXM = new XMLModifier(sklVN); // }else { // errorInfo = MessageFormat.format(Messages.getString("sdl.parse.msg1"), // new Object[]{new File(inputFile).getName()}); // throw new Exception(errorInfo); // } }
Example #28
Source File: XLPHandler.java From translationstudio8 with GNU General Public License v2.0 | 5 votes |
/** * 打开 XLP 文件 * @param xlpPath * XLP 文件路径 * @return ; */ private VTDNav openFile(String xlpPath) { VTDGen vg = new VTDGen(); if (vg.parseFile(xlpPath, true)) { return vg.getNav(); } else { String errorMsg = MessageFormat.format(Messages.getString("file.XLPHandler.logger1"), xlpPath); LOGGER.error(errorMsg); return null; } }
Example #29
Source File: PPTX2XLIFF.java From translationstudio8 with GNU General Public License v2.0 | 5 votes |
/** * 解析 ppt/slideMasters/_rels 目录下的 rels 文件,确定 slideMasterN.xml 与 slideLayoutN.xml 的对应关系 * @throws XPathParseException * @throws XPathEvalException * @throws NavException * ; */ private void parseSlideMasterRels(IProgressMonitor monitor) throws XPathParseException, XPathEvalException, NavException { File relsFile = new File(strTmpFolderPath + File.separator + "ppt" + File.separator + "slideMasters" + File.separator + "_rels"); if (relsFile.isDirectory()) { File[] arrRelFile = relsFile.listFiles(); monitor.beginTask("", arrRelFile.length); VTDGen vg = new VTDGen(); AutoPilot ap = new AutoPilot(); VTDUtils vu = new VTDUtils(); for (File relFile : arrRelFile) { String name = relFile.getName(); monitor.subTask(MessageFormat.format(Messages.getString("pptx.PPTX2XLIFF.task4"), name)); if (relFile.isFile() && name.toLowerCase().endsWith(".rels")) { if (vg.parseFile(relFile.getAbsolutePath(), true)) { ArrayList<String> lstLayout = new ArrayList<String>(); VTDNav vn = vg.getNav(); ap.bind(vn); vu.bind(vn); ap.selectXPath("/Relationships/Relationship"); while (ap.evalXPath() != -1) { String strTarget = vu.getCurrentElementAttribut("Target", ""); if (strTarget.indexOf("slideLayout") != -1) { strTarget = strTarget.substring(strTarget.lastIndexOf("/") + 1); lstLayout.add(strTarget); } } mapLayout.put(name.substring(0, name.lastIndexOf(".")), lstLayout); } } monitor.worked(1); } } monitor.done(); }
Example #30
Source File: PPTX2XLIFF.java From translationstudio8 with GNU General Public License v2.0 | 5 votes |
/** * 解析 slideLayoutN.xml 文件,获取坐标值,因为有的幻灯片中节点的坐标是存放在此文件中的 * @throws NavException * @throws XPathParseException * @throws XPathEvalException */ private void parseSlideLayout() throws NavException, XPathParseException, XPathEvalException { File slideLayoutDic = new File(strTmpFolderPath + File.separator + "ppt" + File.separator + "slideLayouts"); if (slideLayoutDic.isDirectory()) { VTDGen vg = new VTDGen(); AutoPilot ap = new AutoPilot(); ap.declareXPathNameSpace(PREFIX_A, NAMESPACE_A); ap.declareXPathNameSpace(PREFIX_P, NAMESPACE_P); VTDUtils vu = new VTDUtils(); File[] arrSlideLayoutFile = slideLayoutDic.listFiles(); for (File slideLayoutFile : arrSlideLayoutFile) { if (slideLayoutFile.isFile() && slideLayoutFile.getName().toLowerCase().endsWith(".xml")) { if (vg.parseFile(slideLayoutFile.getAbsolutePath(), true)) { String name = slideLayoutFile.getName(); VTDNav vn = vg.getNav(); ap.bind(vn); vu.bind(vn); ap.selectXPath("/p:sldLayout/p:cSld/p:spTree//p:sp[descendant::p:ph[not(@type='dt') and not(@type='sldNum')]]"); ArrayList<String[]> lstPH = new ArrayList<String[]>(); while (ap.evalXPath() != -1) { String strType = getElementAttribute(".//p:ph", "type", vn); String idx = getElementAttribute(".//p:ph", "idx", vn); if (strType == null && idx == null) { continue; } String strX = getElementAttribute(".//a:xfrm/a:off", "x", vn); String strY = getElementAttribute(".//a:xfrm/a:off", "y", vn); if (strX != null && strY != null) { lstPH.add(new String[] { strType, idx, strX, strY }); } } if (lstPH.size() > 0) { mapSldLayoutPH.put(name, lstPH); } } } } } }