use of net.heartsome.cat.ts.core.bean.PropBean in project translationstudio8 by heartsome.
the class TSFileHandler method getProps.
// 获取当前节点下的属性元素子节点。
private Vector<PropBean> getProps(VTDUtils vu) throws XPathParseException, XPathEvalException, NavException {
VTDNav vn = vu.getVTDNav();
Vector<PropBean> props = new Vector<PropBean>();
AutoPilot ap = new AutoPilot(vn);
ap.selectXPath("./prop");
while (ap.evalXPath() != -1) {
String proptype = null;
String value = null;
String lang = null;
int attInx = vn.getAttrVal("prop-type");
if (attInx != -1) {
proptype = vn.toString(attInx);
}
attInx = vn.getAttrVal("xml:lang");
if (attInx != -1) {
lang = vn.toString(attInx);
}
value = vu.getElementContent();
PropBean prop = new PropBean(proptype, value, lang);
props.add(prop);
}
ap.resetXPath();
ap.declareXPathNameSpace(hsNSPrefix, hsR7NSUrl);
ap.selectXPath("./hs:prop");
while (ap.evalXPath() != -1) {
String proptype = null;
String value = null;
String lang = null;
int attInx = vn.getAttrVal("prop-type");
if (attInx != -1) {
proptype = vn.toString(attInx);
}
attInx = vn.getAttrVal("xml:lang");
if (attInx != -1) {
lang = vn.toString(attInx);
}
value = vu.getElementContent();
PropBean prop = new PropBean(proptype, value, lang);
props.add(prop);
}
if (props.isEmpty()) {
props = null;
}
return props;
}
use of net.heartsome.cat.ts.core.bean.PropBean in project translationstudio8 by heartsome.
the class TSFileHandler method getPrpoGroups.
// 获取当前节点下的属性组集合。
private Vector<PropGroupBean> getPrpoGroups(VTDUtils vu) throws XPathParseException, XPathEvalException, NavException {
VTDNav vn = vu.getVTDNav();
Vector<PropGroupBean> pgs = new Vector<PropGroupBean>();
AutoPilot ap = new AutoPilot(vn);
ap.selectXPath("./prop-group");
while (ap.evalXPath() != -1) {
vn.push();
Vector<PropBean> props = getProps(vu);
vn.pop();
PropGroupBean pg = new PropGroupBean(props);
// 获取属性组名称。
int nameInx = vn.getAttrVal("name");
if (nameInx != -1) {
pg.setName(vn.toString(nameInx));
}
pgs.add(pg);
}
ap.resetXPath();
ap.declareXPathNameSpace(hsNSPrefix, hsR7NSUrl);
ap.selectXPath("./hs:prop-group");
while (ap.evalXPath() != -1) {
vn.push();
Vector<PropBean> props = getProps(vu);
vn.pop();
PropGroupBean pg = new PropGroupBean(props);
// 获取属性组名称。
int nameInx = vn.getAttrVal("name");
if (nameInx != -1) {
pg.setName(vn.toString(nameInx));
}
pgs.add(pg);
}
if (pgs.isEmpty()) {
pgs = null;
}
return pgs;
}
Aggregations