use of com.ximpleware.AutoPilot in project translationstudio8 by heartsome.
the class VTDUtilsTest method testGetCurrentElementAttributs2Params.
@Test
public void testGetCurrentElementAttributs2Params() 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> ns = new Hashtable<String, String>();
ns.put("http://www.heartsome.net.cn/2008/XLFExtension", "es");
ns.put("http://www.w3.org/2001/XMLSchema-instance", "es");
Hashtable<String, String> aAtts = vu.getCurrentElementAttributs(ns);
assertEquals(eAtts, aAtts);
}
use of com.ximpleware.AutoPilot in project translationstudio8 by heartsome.
the class VTDUtilsTest method testGetChildElementsCount.
@Test
public void testGetChildElementsCount() throws XPathParseException, XPathEvalException, NavException {
AutoPilot ap = new AutoPilot(vn);
ap.selectXPath("/xliff");
ap.evalXPath();
int count = vu.getChildElementsCount();
assertEquals(2, count);
}
use of com.ximpleware.AutoPilot in project translationstudio8 by heartsome.
the class VTDUtilsTest method testGetChildrenContent.
@Test
public void testGetChildrenContent() throws XPathParseException, XPathEvalException, NavException {
AutoPilot ap = new AutoPilot(vn);
ap.selectXPath("//trans-unit[position()=2]");
ap.evalXPath();
Vector<String> notes = vu.getChildrenContent("note");
assertEquals(3, notes.size());
assertEquals("The 1 note.", notes.get(0));
assertEquals("The 2 note.", notes.get(1));
assertEquals("The 3 note.", notes.get(2));
}
use of com.ximpleware.AutoPilot in project translationstudio8 by heartsome.
the class VTDUtilsTest method testGetElementContent.
@Test
public void testGetElementContent() throws NavException, XPathParseException, XPathEvalException {
AutoPilot ap = new AutoPilot(vn);
ap.selectXPath("//trans-unit/note[position()=1]");
int inx = ap.evalXPath();
assertNotSame(-1, inx);
String txt = vu.getElementContent();
assertEquals("The note 1.", txt);
}
use of com.ximpleware.AutoPilot in project translationstudio8 by heartsome.
the class VTDUtilsTest method testGetElementPureText.
@Test
public void testGetElementPureText() throws XPathParseException, XPathEvalException, NavException {
AutoPilot ap = new AutoPilot(vn);
ap.selectXPath("//trans-unit[position()=1]/source");
int inx = ap.evalXPath();
assertNotSame(-1, inx);
String txt = vu.getElementPureText();
assertEquals("This is the first test.", txt);
}
Aggregations