Iterator<XQueryFunction> fiter = getLocalFunctionLibrary().getFunctionDefinitions(); while (fiter.hasNext()) { XQueryFunction gf = fiter.next();
Iterator fiter = getLocalFunctionLibrary().getFunctionDefinitions(); while (fiter.hasNext()) { XQueryFunction gf = (XQueryFunction)fiter.next();
Iterator<XQueryFunction> fiter = getLocalFunctionLibrary().getFunctionDefinitions(); while (fiter.hasNext()) { XQueryFunction gf = fiter.next();
Iterator fiter = getLocalFunctionLibrary().getFunctionDefinitions(); while (fiter.hasNext()) { XQueryFunction gf = (XQueryFunction)fiter.next();
private FunctionDefinition[] getFunctionDefinitions() { ArrayList<FunctionDefinition> functionDefinitions = new ArrayList<FunctionDefinition>(); Iterator<XQueryFunction> functions = queryModule.getLocalFunctionLibrary().getFunctionDefinitions(); while (functions.hasNext()) { XQueryFunction function = functions.next(); UserFunctionParameter[] params = function.getParameterDefinitions(); Variable[] args = new Variable[params.length]; for (int i = 0; i < params.length; i++) { QName argname = qnameFor (params[i].getVariableQName()); addNamespaceDeclaration(argname); args[i] = new Variable (argname, getTypeDescription(params[i].getRequiredType())); } QName fname = qnameFor(function.getFunctionName()); addNamespaceDeclaration(fname); SequenceType resultType = function.getResultType(); ItemType returnType = resultType.getPrimaryType(); QName returnTypeName = null; if (returnType instanceof NameTest) { returnTypeName = qnameForNameCode (((NameTest) returnType).getFingerprint()); } FunctionDefinition fdef = new FunctionDefinition(fname, valueTypeForItemType(resultType.getPrimaryType()), cardinalityOf(resultType), returnTypeName, args, exprFor (function.getBody())); functionDefinitions.add (fdef); } return functionDefinitions.toArray(new FunctionDefinition[0]); }
/** * Register a user-defined XQuery function. * <p>This method is intended for internal use only.</p> * * @param function the function being declared * @throws net.sf.saxon.trans.XPathException * if an error occurs, for example * a duplicate function name */ public void declareFunction(/*@NotNull*/ XQueryFunction function) throws XPathException { Configuration config = getConfiguration(); if (function.getNumberOfArguments() == 1) { StructuredQName name = function.getFunctionName(); SchemaType t = config.getSchemaType(name); if (t != null && t.isAtomicType()) { XPathException err = new XPathException("Function name " + function.getDisplayName() + " clashes with the name of the constructor function for an atomic type"); err.setErrorCode("XQST0034"); err.setIsStaticError(true); throw err; } } XQueryFunctionLibrary local = getLocalFunctionLibrary(); local.declareFunction(function); //if (!function.isPrivate()) { QueryModule main = getTopLevelModule(); main.globalFunctionLibrary.declareFunction(function); //} }
/** * Register a user-defined XQuery function. * <p>This method is intended for internal use only.</p> * * @param function the function being declared * @throws net.sf.saxon.trans.XPathException * if an error occurs, for example * a duplicate function name */ public void declareFunction(/*@NotNull*/ XQueryFunction function) throws XPathException { Configuration config = getConfiguration(); if (function.getNumberOfArguments() == 1) { StructuredQName name = function.getFunctionName(); SchemaType t = config.getSchemaType(name); if (t != null && t.isAtomicType()) { XPathException err = new XPathException("Function name " + function.getDisplayName() + " clashes with the name of the constructor function for an atomic type"); err.setErrorCode("XQST0034"); err.setIsStaticError(true); throw err; } } XQueryFunctionLibrary local = getLocalFunctionLibrary(); local.declareFunction(function); //if (!function.isPrivate()) { QueryModule main = getTopLevelModule(); main.globalFunctionLibrary.declareFunction(function); //} }
/** * Register a user-defined XQuery function. * <p/> * This method is intended for internal use only. * @param function the function being declared */ public void declareFunction(XQueryFunction function) throws XPathException { Configuration config = getConfiguration(); if (function.getNumberOfArguments() == 1) { StructuredQName name = function.getFunctionName(); int fingerprint = config.getNamePool().getFingerprint(name.getNamespaceURI(), name.getLocalName()); if (fingerprint != -1) { SchemaType t = config.getSchemaType(fingerprint); if (t != null && t.isAtomicType()) { XPathException err = new XPathException("Function name " + function.getDisplayName() + " clashes with the name of the constructor function for an atomic type"); err.setErrorCode("XQST0034"); err.setIsStaticError(true); throw err; } } } XQueryFunctionLibrary local = getLocalFunctionLibrary(); local.declareFunction(function); QueryModule main = getTopLevelModule(); main.globalFunctionLibrary.declareFunction(function); }
/** * Register a user-defined XQuery function. * <p/> * This method is intended for internal use only. * @param function the function being declared */ public void declareFunction(XQueryFunction function) throws XPathException { Configuration config = getConfiguration(); if (function.getNumberOfArguments() == 1) { StructuredQName name = function.getFunctionName(); int fingerprint = config.getNamePool().getFingerprint(name.getNamespaceURI(), name.getLocalName()); if (fingerprint != -1) { SchemaType t = config.getSchemaType(fingerprint); if (t != null && t.isAtomicType()) { XPathException err = new XPathException("Function name " + function.getDisplayName() + " clashes with the name of the constructor function for an atomic type"); err.setErrorCode("XQST0034"); err.setIsStaticError(true); throw err; } } } XQueryFunctionLibrary local = getLocalFunctionLibrary(); local.declareFunction(function); QueryModule main = getTopLevelModule(this); main.globalFunctionLibrary.declareFunction(function); }