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

FindPrefix() private method

private FindPrefix ( string nspace, string &prefix ) : bool
nspace string
prefix string
return bool
        internal bool FindPrefix(string nspace, out string prefix) {
            Debug.Assert(nspace != null);
            for (int i = this.elementScopesStack.Length - 1; 0 <= i; i--) {
                Debug.Assert(this.elementScopesStack[i] is OutputScope);

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

Usage Example

Ejemplo n.º 1
0
        internal string GetPrefixForNamespace(string nspace)
        {
            string?prefix = null;

            if (_scopeManager.FindPrefix(nspace, out prefix))
            {
                Debug.Assert(prefix != null && prefix.Length > 0);
                return(prefix);
            }
            else
            {
                return(DeclareNewNamespace(nspace));
            }
        }