uri = env.getURIForPrefix(prefix);
}
StructuredQName functionName = new StructuredQName(prefix, uri, parts[1]);
b = (env.getFunctionLibrary().getFunctionSignature(functionName, (int)arity)) != null;
} catch (QNameException e) {
XPathException err = new XPathException(e.getMessage());
err.setErrorCode("XTDE1400");
throw err;
} catch (XPathException e2) {
if ("XTDE0290".equals(e2.getErrorCodeLocalPart())) {
e2.setErrorCode("XTDE1400");
}
throw e2;
}
break;
case TYPE_AVAILABLE:
try {
String[] parts = config.getNameChecker().getQNameParts(lexicalQName);
String prefix = parts[0];
String uri;
if (prefix.length() == 0) {
uri = env.getDefaultElementNamespace();
} else {
uri = env.getURIForPrefix(prefix);
}
if (uri.equals(NamespaceConstant.JAVA_TYPE)) {
try {
config.getClass(parts[1], false, null);
b = true;
} catch (XPathException err) {
b = false;
}
} else {
int fingerprint = config.getNamePool().allocate(prefix, uri, parts[1]) & 0xfffff;
SchemaType type = config.getSchemaType(fingerprint);
if (type instanceof BuiltInAtomicType) {
b = env.isAllowedBuiltInType((BuiltInAtomicType)type);
} else if (type instanceof BuiltInListType) {
b = visitor.getExecutable().isSchemaAware();
} else {
b = (type != null && (uri.equals(NamespaceConstant.SCHEMA) || env.isImportedSchema(uri)));
}
}
} catch (QNameException e) {
XPathException err = new XPathException(e.getMessage());
err.setErrorCode("XTDE1425");
throw err;
}
}
return Literal.makeLiteral(BooleanValue.get(b));
}