use of org.eclipse.wst.xml.xpath2.processor.internal.types.QName in project webtools.sourceediting by eclipse.
the class DefaultEvaluator method visit.
/**
* visit schema element test.
*
* @param e
* is the schema element test.
* @return a result sequence
*/
public Object visit(SchemaElemTest e) {
// filter out all elements
ResultSequence rs = kind_test((ResultSequence) ((Pair) _param)._two, ElementType.class);
// match the name
// XXX substitution groups
QName name = e.name();
for (Iterator i = rs.iterator(); i.hasNext(); ) {
if (!name_test((ElementType) i.next(), name, "element"))
i.remove();
}
// check the type
TypeDefinition et = _sc.getTypeModel().lookupElementDeclaration(name.namespace(), name.local());
for (Iterator i = rs.iterator(); i.hasNext(); ) {
NodeType node = (NodeType) i.next();
if (!derivesFrom(node, et)) {
i.remove();
continue;
}
XSBoolean nilled = (XSBoolean) node.nilled().first();
// XXX or, in schema it is nillable
if (nilled.value())
i.remove();
}
return rs;
}
use of org.eclipse.wst.xml.xpath2.processor.internal.types.QName in project webtools.sourceediting by eclipse.
the class StaticNameResolver method visit.
/**
* Validate a cast expression.
*
* @param cexp
* is the expression.
* @return null.
*/
public Object visit(CastExpr cexp) {
printBinExpr("CAST", cexp);
SingleType st = (SingleType) cexp.right();
QName type = st.type();
javax.xml.namespace.QName qName = type.asQName();
Function f = _sc.resolveFunction(qName, 1);
if (f == null)
reportError(new StaticFunctNameError("Type does not exist: " + type.toString()));
cexp.set_function(f);
_resolvedFunctions.add(qName);
return null;
}
use of org.eclipse.wst.xml.xpath2.processor.internal.types.QName in project webtools.sourceediting by eclipse.
the class StaticNameResolver method visit.
/**
* Validate a function call.
*
* @param e
* is the expression.
* @return null.
*/
public Object visit(FunctionCall e) {
QName name = e.name();
if (!expandFunctionQName(name))
reportBadPrefix(name.prefix());
javax.xml.namespace.QName qName = name.asQName();
Function f = _sc.resolveFunction(qName, e.arity());
if (f == null)
reportError(new StaticFunctNameError("Function does not exist: " + name.string() + " arity: " + e.arity()));
e.set_function(f);
_resolvedFunctions.add(qName);
visitExprs(e.iterator());
return null;
}
use of org.eclipse.wst.xml.xpath2.processor.internal.types.QName in project webtools.sourceediting by eclipse.
the class DefaultStaticContext method function_exists.
/**
* Check for existance of function.
*
* @param name
* function name.
* @param arity
* arity of function.
* @return true if function exists. False otherwise.
*/
public boolean function_exists(QName name, int arity) {
String ns = name.namespace();
if (!_functions.containsKey(ns))
return false;
FunctionLibrary fl = (FunctionLibrary) _functions.get(ns);
return fl.function_exists(name, arity);
}
use of org.eclipse.wst.xml.xpath2.processor.internal.types.QName in project webtools.sourceediting by eclipse.
the class DefaultStaticContext method function.
public Function function(QName name, int arity) {
String ns = name.namespace();
if (!_functions.containsKey(ns))
return null;
FunctionLibrary fl = (FunctionLibrary) _functions.get(ns);
return fl.function(name, arity);
}
Aggregations