System.Xml.Xsl.XsltOld.OutputScope.FindPrefix C# (CSharp) Method

FindPrefix() private method

private FindPrefix ( string urn, string &prefix ) : bool
urn string
prefix string
return bool
        internal bool FindPrefix(string urn, out string prefix) {
            Debug.Assert(urn != null);

            for (NamespaceDecl scope = this.scopes; scope != null; scope = scope.Next) {
                if (Keywords.Equals(scope.Uri, urn) &&
                    scope.Prefix != null            &&
                    scope.Prefix.Length > 0) {
                    prefix = scope.Prefix;
                    return true;
                }
            }

            prefix = string.Empty;
            return false;
        }
    }

Usage Example

Ejemplo n.º 1
0
        internal bool FindPrefix(string nspace, out string prefix)
        {
            Debug.Assert(nspace != null);
            for (int i = _elementScopesStack.Length - 1; 0 <= i; i--)
            {
                Debug.Assert(_elementScopesStack[i] is OutputScope);

                OutputScope elementScope = (OutputScope)_elementScopesStack[i];
                string      pfx          = null;
                if (elementScope.FindPrefix(nspace, out pfx))
                {
                    string testNspace = ResolveNamespace(pfx);
                    if (testNspace != null && Ref.Equal(testNspace, nspace))
                    {
                        prefix = pfx;
                        return(true);
                    }
                    else
                    {
                        break;
                    }
                }
            }
            prefix = null;
            return(false);
        }