use of org.eclipse.wst.xml.xpath2.processor.internal.types.QName in project webtools.sourceediting by eclipse.
the class FnInScopePrefixes method inScopePrefixes.
/**
* Prefix-from-QName operation.
*
* @param args
* Result from the expressions evaluation.
* @throws DynamicError
* Dynamic error.
* @return Result of fn:prefix-from-QName operation.
*/
public static ResultSequence inScopePrefixes(Collection args, DynamicContext dc) throws DynamicError {
// Collection cargs = Function.convert_arguments(args, expected_args());
Collection cargs = args;
ResultSequence arg1 = (ResultSequence) cargs.iterator().next();
if (arg1.empty())
return ResultBuffer.EMPTY;
ResultBuffer rs = new ResultBuffer();
Item anytype = arg1.item(0);
if (!(anytype instanceof ElementType)) {
throw new DynamicError(TypeError.invalid_type(null));
}
ElementType element = (ElementType) anytype;
List prefixList = lookupPrefixes(element);
createPrefixResultSet(rs, prefixList);
return rs.getSequence();
}
use of org.eclipse.wst.xml.xpath2.processor.internal.types.QName in project webtools.sourceediting by eclipse.
the class FnName method name.
/**
* Name operation.
*
* @param args
* Result from the expressions evaluation.
* @param context
* Dynamic context.
* @throws DynamicError
* Dynamic error.
* @return Result of fn:name operation.
*/
public static ResultSequence name(Collection args, EvaluationContext ec) throws DynamicError {
Collection cargs = Function.convert_arguments(args, expected_args());
// get arg
ResultSequence arg1 = null;
if (cargs.isEmpty()) {
if (ec.getContextItem() == null)
throw DynamicError.contextUndefined();
else {
arg1 = ResultBuffer.wrap(ec.getContextItem());
}
} else {
arg1 = (ResultSequence) cargs.iterator().next();
}
if (arg1.empty()) {
return new XSString("");
}
NodeType an = (NodeType) arg1.first();
QName name = an.node_name();
String sname = "";
if (name != null)
sname = name.getStringValue();
return new XSString(sname);
}
use of org.eclipse.wst.xml.xpath2.processor.internal.types.QName in project webtools.sourceediting by eclipse.
the class Function method signature.
/**
* Apply the name and arity to signature.
*
* @param name
* QName.
* @param arity
* arity of the function.
* @return Signature.
*/
public static String signature(QName name, int arity) {
String n = name.expanded_name();
if (n == null)
return null;
n += "_";
if (arity < 0)
n += "x";
else
n += arity;
return n;
}
use of org.eclipse.wst.xml.xpath2.processor.internal.types.QName in project webtools.sourceediting by eclipse.
the class ConstructorFL method add_abstract_type.
/**
* Adds a type into the functions library as an abstract type.
*
* @param at
* input of any atomic type.
*/
public void add_abstract_type(String localName, AnyAtomicType at) {
QName name = new QName(localName);
name.set_namespace(namespace());
_types.put(name, at);
}
use of org.eclipse.wst.xml.xpath2.processor.internal.types.QName in project webtools.sourceediting by eclipse.
the class ConstructorFL method add_type.
/**
* Adds a type into the functions library.
*
* @param at
* input of any atomic type.
*/
public void add_type(CtrType at) {
QName name = new QName(at.type_name());
name.set_namespace(namespace());
_types.put(name, at);
add_function(new Constructor(at));
}
Aggregations