use of org.teiid.query.sql.lang.XMLTable.XMLColumn in project teiid by teiid.
the class SaxonXQueryExpression method processColumns.
private void processColumns(List<XMLTable.XMLColumn> columns, IndependentContext ic) throws QueryResolverException {
if (columns == null) {
return;
}
XPathEvaluator eval = new XPathEvaluator(config);
eval.setStaticContext(ic);
for (XMLColumn xmlColumn : columns) {
if (xmlColumn.isOrdinal()) {
continue;
}
String path = xmlColumn.getPath();
if (path == null) {
path = xmlColumn.getName();
}
path = path.trim();
if (path.startsWith("/")) {
// $NON-NLS-1$
if (path.startsWith("//")) {
// $NON-NLS-1$
path = '.' + path;
} else {
path = path.substring(1);
}
}
XPathExpression exp;
try {
exp = eval.createExpression(path);
} catch (XPathException e) {
throw new QueryResolverException(QueryPlugin.Event.TEIID30155, e, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30155, xmlColumn.getName(), xmlColumn.getPath()));
}
xmlColumn.setPathExpression(exp);
}
}
Aggregations