Ejemplo n.º 1
0
        internal string ResolveNamespace(string prefix, out bool thisScope)
        {
            Debug.Assert(prefix != null);
            thisScope = true;

            if (prefix == null || prefix.Length == 0)
            {
                return(_defaultNS);
            }
            else
            {
                if (Ref.Equal(prefix, _atoms.Xml))
                {
                    return(_atoms.XmlNamespace);
                }
                else if (Ref.Equal(prefix, _atoms.Xmlns))
                {
                    return(_atoms.XmlnsNamespace);
                }

                for (int i = _elementScopesStack.Length - 1; i >= 0; i--)
                {
                    Debug.Assert(_elementScopesStack[i] is OutputScope);
                    OutputScope elementScope = (OutputScope)_elementScopesStack[i];

                    string nspace = elementScope.ResolveAtom(prefix);
                    if (nspace != null)
                    {
                        thisScope = (i == _elementScopesStack.Length - 1);
                        return(nspace);
                    }
                }
            }

            return(null);
        }