private IXsltContextFunction GetExtentionMethod(string ns, string name, XPathResultType[] argTypes, out object extension) { FuncExtension result = null; extension = this.processor.GetScriptObject(ns); if (extension != null) { MethodInfo method = FindBestMethod(extension.GetType().GetMethods(bindingFlags), /*ignoreCase:*/ true, /*publicOnly:*/ false, name, argTypes); if (method != null) { result = new FuncExtension(extension, method, /*permissions*/ null); } return(result); } extension = this.processor.GetExtensionObject(ns); if (extension != null) { MethodInfo method = FindBestMethod(extension.GetType().GetMethods(bindingFlags), /*ignoreCase:*/ false, /*publicOnly:*/ true, name, argTypes); if (method != null) { result = new FuncExtension(extension, method, this.processor.permissions); } return(result); } return(null); }
public override IXsltContextFunction ResolveFunction(string prefix, string name, XPathResultType[] argTypes) { IXsltContextFunction func = null; if (prefix == String.Empty) { func = s_FunctionTable[name] as IXsltContextFunction; } else { string ns = this.LookupNamespace(prefix); if (ns == Keywords.s_MsXsltNamespace && name == f_NodeSet) { func = s_FuncNodeSet; } else { object extension; MethodInfo method = GetExtentionMethod(ns, name, argTypes, out extension); if (extension == null) { throw new XsltException(Res.Xslt_ScriptInvalidPrefix, prefix); } if (method != null) { func = new FuncExtension(extension, method); } } } if (func == null) { throw new XsltException(Res.Xslt_UnknownXsltFunction, name); } if (argTypes.Length < func.Minargs || func.Maxargs < argTypes.Length) { throw new XsltException(Res.Xslt_WrongNumberArgs, name, Convert.ToString(argTypes.Length)); } return(func); }
private IXsltContextFunction GetExtentionMethod(string ns, string name, XPathResultType[] argTypes, out object extension) { FuncExtension result = null; extension = this.processor.GetScriptObject(ns); if (extension != null) { MethodInfo method = FindBestMethod(extension.GetType().GetMethods(bindingFlags), /*ignoreCase:*/true, /*publicOnly:*/false, name, argTypes); if (method != null) { result = new FuncExtension(extension, method, /*permissions*/null); } return result; } extension = this.processor.GetExtensionObject(ns); if(extension != null) { MethodInfo method = FindBestMethod(extension.GetType().GetMethods(bindingFlags), /*ignoreCase:*/false, /*publicOnly:*/true, name, argTypes); if (method != null) { result = new FuncExtension(extension, method, this.processor.permissions); } return result; } return null; }
public override IXsltContextFunction ResolveFunction(string prefix, string name, XPathResultType[] argTypes) { IXsltContextFunction func = null; if(prefix == String.Empty) { func = s_FunctionTable[name] as IXsltContextFunction; } else { string ns = this.LookupNamespace(prefix); if (ns == Keywords.s_MsXsltNamespace && name == f_NodeSet) { func = s_FuncNodeSet; } else { object extension; MethodInfo method = GetExtentionMethod(ns, name, argTypes, out extension); if(extension == null) { throw new XsltException(Res.Xslt_ScriptInvalidPrefix, prefix); } if(method != null) { func = new FuncExtension(extension, method); } } } if (func == null) { throw new XsltException(Res.Xslt_UnknownXsltFunction, name); } if (argTypes.Length < func.Minargs || func.Maxargs < argTypes.Length) { throw new XsltException(Res.Xslt_WrongNumberArgs, name, Convert.ToString(argTypes.Length)); } return func; }