System.Xml.Xsl.Runtime.XmlQueryRuntime.EarlyBoundFunctionExists C# (CSharp) Method

EarlyBoundFunctionExists() public method

Return true if the early bound object identified by "namespaceUri" contains a method that matches "name".
public EarlyBoundFunctionExists ( string name, string namespaceUri ) : bool
name string
namespaceUri string
return bool
        public bool EarlyBoundFunctionExists(string name, string namespaceUri) {
            if (this.earlyInfo == null)
                return false;

            for (int idx = 0; idx < this.earlyInfo.Length; idx++) {
                if (namespaceUri == this.earlyInfo[idx].NamespaceUri)
                    return new XmlExtensionFunction(name, namespaceUri, -1, this.earlyInfo[idx].EarlyBoundType, EarlyBoundFlags).CanBind();
            }

            return false;
        }

Usage Example

Exemplo n.º 1
0
        private bool FunctionAvailableHelper(XmlQualifiedName name)
        {
            // Is this an XPath or an XSLT function?
            if (QilGenerator.IsFunctionAvailable(name.Name, name.Namespace))
            {
                return(true);
            }

            // Script blocks and extension objects cannot implement neither null nor XSLT namespace
            if (name.Namespace.Length == 0 || name.Namespace == XmlReservedNs.NsXslt)
            {
                return(false);
            }

            // Is this an extension object function?
            if (_runtime.ExternalContext.LateBoundFunctionExists(name.Name, name.Namespace))
            {
                return(true);
            }

            // Is this a script function?
            return(_runtime.EarlyBoundFunctionExists(name.Name, name.Namespace));
        }