Search in sources :

Example 1 with NamespaceItem

use of org.teiid.query.sql.symbol.XMLNamespaces.NamespaceItem in project teiid by teiid.

the class Evaluator method namespaces.

private Evaluator.NameValuePair<String>[] namespaces(XMLNamespaces namespaces) {
    if (namespaces == null) {
        return null;
    }
    List<NamespaceItem> args = namespaces.getNamespaceItems();
    Evaluator.NameValuePair<String>[] nameValuePairs = new Evaluator.NameValuePair[args.size()];
    for (int i = 0; i < args.size(); i++) {
        NamespaceItem item = args.get(i);
        nameValuePairs[i] = new Evaluator.NameValuePair<String>(item.getPrefix(), item.getUri());
    }
    return nameValuePairs;
}
Also used : NamespaceItem(org.teiid.query.sql.symbol.XMLNamespaces.NamespaceItem) XQueryEvaluator(org.teiid.query.xquery.saxon.XQueryEvaluator)

Example 2 with NamespaceItem

use of org.teiid.query.sql.symbol.XMLNamespaces.NamespaceItem in project teiid by teiid.

the class SQLStringVisitor method visit.

@Override
public void visit(XMLNamespaces obj) {
    append(XMLNAMESPACES);
    // $NON-NLS-1$
    append("(");
    for (Iterator<NamespaceItem> items = obj.getNamespaceItems().iterator(); items.hasNext(); ) {
        NamespaceItem item = items.next();
        if (item.getPrefix() == null) {
            if (item.getUri() == null) {
                // $NON-NLS-1$
                append("NO DEFAULT");
            } else {
                // $NON-NLS-1$
                append("DEFAULT ");
                visitNode(new Constant(item.getUri()));
            }
        } else {
            visitNode(new Constant(item.getUri()));
            // $NON-NLS-1$
            append(" AS ");
            outputDisplayName(item.getPrefix());
        }
        if (items.hasNext()) {
            // $NON-NLS-1$
            append(", ");
        }
    }
    // $NON-NLS-1$
    append(")");
}
Also used : NamespaceItem(org.teiid.query.sql.symbol.XMLNamespaces.NamespaceItem)

Aggregations

NamespaceItem (org.teiid.query.sql.symbol.XMLNamespaces.NamespaceItem)2 XQueryEvaluator (org.teiid.query.xquery.saxon.XQueryEvaluator)1