internal IDictionary<string, string> GetNamespacesInScope(XmlNamespaceScope scope)
 {
     if (this.reader is IXmlNamespaceResolver)
     {
         return ((IXmlNamespaceResolver) this.reader).GetNamespacesInScope(scope);
     }
     return null;
 }
Example #2
0
        public IDictionary<string, string> GetNamespacesInScope(XmlNamespaceScope scope) {
            switch(scope) {
                case XmlNamespaceScope.All:
                    return GetNamespaceDecls(null, false);

                case XmlNamespaceScope.Local:
                    return GetNamespaceDecls(element.Parent, false);

                case XmlNamespaceScope.ExcludeXml:
                    return GetNamespaceDecls(null, true);
            }
            return null;
        }
		public virtual IDictionary<string, string> GetNamespacesInScope (XmlNamespaceScope scope)
		{
			IDictionary namespaceTable = GetNamespacesInScopeImpl (scope);
			IDictionary<string, string> namespaces = new Dictionary<string, string>(namespaceTable.Count);

			foreach (DictionaryEntry entry in namespaceTable) {
				namespaces[(string) entry.Key] = (string) entry.Value;
			}
			return namespaces;
		}
Example #4
0
 public IDictionary <string, string> GetNamespacesInScope(XmlNamespaceScope scope) => _other.GetNamespacesInScope(scope);
//
// IXmlNamespaceResolver implementation
//
        IDictionary<string,string> IXmlNamespaceResolver.GetNamespacesInScope( XmlNamespaceScope scope ) {
            if ( !InNamespaceActiveState ) {
                return new Dictionary<string,string>();
            }
            return nsManager.GetNamespacesInScope( scope );
        }
 internal IDictionary<string, string> GetNamespacesInScope(XmlNamespaceScope scope)
 {
     Dictionary<string, string> dictionary = new Dictionary<string, string>();
     if (!this.bCreatedOnAttribute)
     {
         XmlNode curNode = this.curNode;
         while (curNode != null)
         {
             if (curNode.NodeType == XmlNodeType.Element)
             {
                 XmlElement element = (XmlElement) curNode;
                 if (element.HasAttributes)
                 {
                     XmlAttributeCollection attributes = element.Attributes;
                     for (int i = 0; i < attributes.Count; i++)
                     {
                         XmlAttribute attribute = attributes[i];
                         if ((attribute.LocalName == "xmlns") && (attribute.Prefix.Length == 0))
                         {
                             if (!dictionary.ContainsKey(string.Empty))
                             {
                                 dictionary.Add(this.nameTable.Add(string.Empty), this.nameTable.Add(attribute.Value));
                             }
                         }
                         else if (attribute.Prefix == "xmlns")
                         {
                             string localName = attribute.LocalName;
                             if (!dictionary.ContainsKey(localName))
                             {
                                 dictionary.Add(this.nameTable.Add(localName), this.nameTable.Add(attribute.Value));
                             }
                         }
                     }
                 }
                 if (scope == XmlNamespaceScope.Local)
                 {
                     break;
                 }
             }
             else if (curNode.NodeType == XmlNodeType.Attribute)
             {
                 curNode = ((XmlAttribute) curNode).OwnerElement;
                 continue;
             }
             curNode = curNode.ParentNode;
         }
         if (scope != XmlNamespaceScope.Local)
         {
             if (dictionary.ContainsKey(string.Empty) && (dictionary[string.Empty] == string.Empty))
             {
                 dictionary.Remove(string.Empty);
             }
             if (scope == XmlNamespaceScope.All)
             {
                 dictionary.Add(this.nameTable.Add("xml"), this.nameTable.Add("http://www.w3.org/XML/1998/namespace"));
             }
         }
     }
     return dictionary;
 }
        // This pragma disables a warning that the return type is not CLS-compliant, but generics are part of CLS in Whidbey. 
#pragma warning disable 3002
        public virtual IDictionary<string, string> GetNamespacesInScope(XmlNamespaceScope scope)
        {
#pragma warning restore 3002
            int i = 0;
            switch (scope)
            {
                case XmlNamespaceScope.All:
                    i = 2;
                    break;
                case XmlNamespaceScope.ExcludeXml:
                    i = 3;
                    break;
                case XmlNamespaceScope.Local:
                    i = _lastDecl;
                    while (_nsdecls[i].scopeId == _scopeId)
                    {
                        i--;
                        Debug.Assert(i >= 2);
                    }
                    i++;
                    break;
            }

            Dictionary<string, string> dict = new Dictionary<string, string>(_lastDecl - i + 1);
            for (; i <= _lastDecl; i++)
            {
                string prefix = _nsdecls[i].prefix;
                string uri = _nsdecls[i].uri;
                Debug.Assert(prefix != null);

                if (uri != null)
                {
                    if (uri.Length > 0 || prefix.Length > 0 || scope == XmlNamespaceScope.Local)
                    {
                        dict[prefix] = uri;
                    }
                    else
                    {
                        // default namespace redeclared to "" -> remove from list for all scopes other than local
                        dict.Remove(prefix);
                    }
                }
            }
            return dict;
        }
 public IDictionary<string, string> GetNamespacesInScope(XmlNamespaceScope scope)
 {
 }
		public virtual IDictionary<string, string> GetNamespacesInScope (XmlNamespaceScope scope)
		{
			IDictionary<string, string> table = new Dictionary<string, string> ();
			XPathNamespaceScope xpscope =
				scope == XmlNamespaceScope.Local ?
					XPathNamespaceScope.Local :
				scope == XmlNamespaceScope.ExcludeXml ?
					XPathNamespaceScope.ExcludeXml :
				XPathNamespaceScope.All;
			XPathNavigator nav = Clone ();
			if (nav.NodeType != XPathNodeType.Element)
				nav.MoveToParent ();
			if (!nav.MoveToFirstNamespace (xpscope))
				return table;
			do {
				table.Add (nav.Name, nav.Value);
			} while (nav.MoveToNextNamespace (xpscope));
			return table;
		}
Example #10
0
 public IDictionary <string, string> GetNamespacesInScope(XmlNamespaceScope scope)
 {
     return(((IXmlNamespaceResolver)Current).GetNamespacesInScope(scope));
 }
 IDictionary <string, string> IXmlNamespaceResolver.GetNamespacesInScope(XmlNamespaceScope scope)
 {
     throw NotImplemented.ByDesign;
 }
Example #12
0
 IDictionary <string, string> IXmlNamespaceResolver.GetNamespacesInScope(XmlNamespaceScope scope)
 {
     return((this.baseReaderAsNamespaceResolver == null) ? null : this.baseReaderAsNamespaceResolver.GetNamespacesInScope(scope));
 }
 IDictionary <string, string> IXmlNamespaceResolver.GetNamespacesInScope(XmlNamespaceScope scope)
 {
     throw new NotImplementedException();
 }
Example #14
0
 // Internal IXmlNamespaceResolver methods
 internal IDictionary <string, string> GetNamespacesInScope(XmlNamespaceScope scope)
 {
     return(_coreReaderNSResolver !.GetNamespacesInScope(scope));
 }
Example #15
0
 internal IDictionary <string, string>?GetNamespacesInScope(XmlNamespaceScope scope)
 {
     return((reader is IXmlNamespaceResolver) ? ((IXmlNamespaceResolver)reader).GetNamespacesInScope(scope) : null);
 }
 public IDictionary <string, string> GetNamespacesInScope(
     XmlNamespaceScope scope)
 {
     return(context.NamespaceManager.GetNamespacesInScope(scope));
 }
Example #17
0
 // Internal IXmlNamespaceResolver methods
 internal IDictionary<string, string> GetNamespacesInScope(XmlNamespaceScope scope)
 {
     return _namespaceManager.GetNamespacesInScope(scope);
 }
 /// <summary>
 /// Not implemented. Method required by <see cref="IXmlNamespaceResolver"/>.
 /// </summary>
 /// <param name="scope">Scope</param>
 /// <returns>Namespaces</returns>
 public System.Collections.Generic.IDictionary <string, string> GetNamespacesInScope(XmlNamespaceScope scope)
 {
     throw new NotImplementedException();
 }
 public virtual IDictionary<string, string> GetNamespacesInScope(XmlNamespaceScope scope)
 {
     XPathNodeType nodeType = this.NodeType;
     if (((nodeType != XPathNodeType.Element) && (scope != XmlNamespaceScope.Local)) || ((nodeType == XPathNodeType.Attribute) || (nodeType == XPathNodeType.Namespace)))
     {
         XPathNavigator navigator = this.Clone();
         if (navigator.MoveToParent())
         {
             return navigator.GetNamespacesInScope(scope);
         }
     }
     Dictionary<string, string> dictionary = new Dictionary<string, string>();
     if (scope == XmlNamespaceScope.All)
     {
         dictionary["xml"] = "http://www.w3.org/XML/1998/namespace";
     }
     if (this.MoveToFirstNamespace((XPathNamespaceScope) scope))
     {
         do
         {
             string localName = this.LocalName;
             string str2 = this.Value;
             if (((localName.Length != 0) || (str2.Length != 0)) || (scope == XmlNamespaceScope.Local))
             {
                 dictionary[localName] = str2;
             }
         }
         while (this.MoveToNextNamespace((XPathNamespaceScope) scope));
         this.MoveToParent();
     }
     return dictionary;
 }
Example #20
0
 IDictionary <string, string> IXmlNamespaceResolver.GetNamespacesInScope(XmlNamespaceScope scope)
 {
     return(_namespaceManager !.GetNamespacesInScope(scope));
 }
Example #21
0
 IDictionary<string, string> IXmlNamespaceResolver.GetNamespacesInScope(XmlNamespaceScope scope)
 {
     return _nav.GetNamespacesInScope(scope);
 }
Example #22
0
 public IDictionary <string, string> GetNamespacesInScope(XmlNamespaceScope scope)
 {
     return(Navigator.GetNamespacesInScope(scope));
 }
Example #23
0
 public override IDictionary <string, string> GetNamespacesInScope(XmlNamespaceScope scope)
 {
     return(null);
 }
Example #24
0
 IDictionary<string,string> IXmlNamespaceResolver.GetNamespacesInScope ( XmlNamespaceScope scope ) {
     return (_readerAsResolver == null) ? null : _readerAsResolver.GetNamespacesInScope( scope ); 
 }
Example #25
0
 public System.Collections.Generic.IDictionary<string, string> GetNamespacesInScope (XmlNamespaceScope scope) {
     throw new NotImplementedException ();
 }
            internal IDictionary<string,string> GetNamespacesInScope( XmlNamespaceScope scope ) {
                Dictionary<string,string> dict = new Dictionary<string, string>();
                if( this.bCreatedOnAttribute )
                    return dict;

                // walk up the XmlNode parent chain and add all namespace declarations to the dictionary
                XmlNode node = curNode;
                while ( node != null ) {
                    if ( node.NodeType == XmlNodeType.Element ) {
                        XmlElement elem = (XmlElement)node;
                        if ( elem.HasAttributes ) {
                            XmlAttributeCollection attrs = elem.Attributes;
                            for ( int i = 0; i < attrs.Count; i++ ) {
                                XmlAttribute a = attrs[i];
                                if ( a.LocalName == "xmlns" && a.Prefix.Length == 0 ) {
                                    if  ( !dict.ContainsKey( string.Empty ) ) {
                                        dict.Add( nameTable.Add( string.Empty ), nameTable.Add( a.Value ) );
                                    }
                                }
                                else if ( a.Prefix == "xmlns" ) {
                                    string localName = a.LocalName;
                                    if ( !dict.ContainsKey( localName ) ) {
                                        dict.Add( nameTable.Add( localName ), nameTable.Add( a.Value ) );
                                    }
                                }
                            }
                        }
                        if ( scope == XmlNamespaceScope.Local ) {
                            break;
                        }
                    } 
                    else if ( node.NodeType == XmlNodeType.Attribute ) {
                        node = ((XmlAttribute)node).OwnerElement;
                        continue;
                    }
                    node = node.ParentNode;
                };

                if ( scope != XmlNamespaceScope.Local ) {
                    if ( dict.ContainsKey( string.Empty ) && dict[string.Empty] == string.Empty ) {
                        dict.Remove( string.Empty );
                    }
                    if ( scope == XmlNamespaceScope.All ) {
                        dict.Add( nameTable.Add( "xml" ), nameTable.Add( XmlReservedNs.NsXml ) );
                    }
                }
                return dict;
            }
Example #27
0
 IDictionary <string, string> IXmlNamespaceResolver.GetNamespacesInScope(XmlNamespaceScope scope)
 {
     return(((IXmlNamespaceResolver)reader).GetNamespacesInScope(scope));
 }
        IDictionary <string, string> IXmlNamespaceResolver.GetNamespacesInScope(XmlNamespaceScope scope)
        {
            Contract.Ensures(Contract.Result <IDictionary <string, string> >() != null);

            return(default(IDictionary <string, string>));
        }
Example #29
0
 internal IDictionary<string, string> GetNamespacesInScope(XmlNamespaceScope scope)
 {
     return (reader is IXmlNamespaceResolver) ? ((IXmlNamespaceResolver)reader).GetNamespacesInScope(scope) : null;
 }
 public IDictionary <string, string> GetNamespacesInScope(XmlNamespaceScope scope)
 {
     throw new NotImplementedException();
 }
Example #31
0
		IDictionary IXmlNamespaceResolver.GetNamespacesInScope (XmlNamespaceScope scope)
		{
			return GetNamespacesInScopeImpl (scope);
		}
Example #32
0
		///<summary>
		///Gets a collection of defined prefix-namespace Mappings that are currently in scope.
		///</summary>
		///
		///<returns>
		///An <see cref="T:System.Collections.IDictionary"></see> that contains the current in-scope namespaces.
		///</returns>
		///
		///<param name="scope">An <see cref="T:System.Xml.XmlNamespaceScope"></see> value that specifies the type of namespace nodes to return.</param>
		IDictionary<string, string> IXmlNamespaceResolver.GetNamespacesInScope(XmlNamespaceScope scope)
		{
			XmlNamespaceCollection namespaces = readingElements.Peek().Namespaces;
			Dictionary<String, String> list = new Dictionary<string, string>();
			foreach (XmlNamespace ns in namespaces)
			{
				list.Add(ns.Prefix, ns.Namespace);
			}

			return list;
		}
Example #33
0
		IDictionary<string, string> IXmlNamespaceResolver.GetNamespacesInScope (XmlNamespaceScope scope)
		{
			return ((IXmlNamespaceResolver) reader).GetNamespacesInScope (scope);
		}
 public virtual IDictionary<string, string> GetNamespacesInScope(XmlNamespaceScope scope)
 {
     return Resolver.GetNamespacesInScope(scope);
 }
		internal virtual IDictionary GetNamespacesInScopeImpl (XmlNamespaceScope scope)
		{
			Hashtable table = new Hashtable ();

			if (scope == XmlNamespaceScope.Local) {
				for (int i = 0; i < count; i++)
					if (decls [declPos - i].Prefix == String.Empty && decls [declPos - i].Uri == String.Empty) {
						if (table.Contains (String.Empty))
							table.Remove (String.Empty);
					}
					else if (decls [declPos - i].Uri != null)
						table.Add (decls [declPos - i].Prefix, decls [declPos - i].Uri);
				return table;
			} else {
				for (int i = 0; i <= declPos; i++) {
					if (decls [i].Prefix == String.Empty && decls [i].Uri == String.Empty) {
						// removal of default namespace
						if (table.Contains (String.Empty))
							table.Remove (String.Empty);
					}
					else if (decls [i].Uri != null)
						table [decls [i].Prefix] = decls [i].Uri;
				}

				if (scope == XmlNamespaceScope.All)
					table.Add ("xml", XmlNamespaceManager.XmlnsXml);
				return table;
			}
		}
Example #36
0
		IDictionary<string, string> IXmlNamespaceResolver.GetNamespacesInScope (XmlNamespaceScope scope)
		{
			return nsResolver != null ? nsResolver.GetNamespacesInScope (scope) : 
				new Dictionary<string, string> ();
		}
 //
 // IXmlNamespaceResolver members
 //
 IDictionary<string, string> IXmlNamespaceResolver.GetNamespacesInScope(XmlNamespaceScope scope) {
     if (coreReaderNSResolver != null) {
         return coreReaderNSResolver.GetNamespacesInScope(scope);
     }
     else {
         return nsManager.GetNamespacesInScope(scope);
     }
 }
Example #38
0
        public virtual IDictionary<string, string> GetNamespacesInScope(XmlNamespaceScope scope)
        {
            XPathNodeType nt = NodeType;
            if ((nt != XPathNodeType.Element && scope != XmlNamespaceScope.Local) || nt == XPathNodeType.Attribute || nt == XPathNodeType.Namespace)
            {
                XPathNavigator navSave = Clone();

                // If current item is not an element, then try parent
                if (navSave.MoveToParent())
                    return navSave.GetNamespacesInScope(scope);
            }

            Dictionary<string, string> dict = new Dictionary<string, string>();

            // "xml" prefix always in scope
            if (scope == XmlNamespaceScope.All)
                dict["xml"] = XmlConst.ReservedNsXml;

            // Now add all in-scope namespaces
            if (MoveToFirstNamespace((XPathNamespaceScope)scope))
            {
                do
                {
                    string prefix = LocalName;
                    string ns = Value;

                    // Exclude xmlns="" declarations unless scope = Local
                    if (prefix.Length != 0 || ns.Length != 0 || scope == XmlNamespaceScope.Local)
                        dict[prefix] = ns;
                }
                while (MoveToNextNamespace((XPathNamespaceScope)scope));

                MoveToParent();
            }

            return dict;
        }
// This pragma disables a warning that the return type is not CLS-compliant, but generics are part of CLS in Whidbey. 
#pragma warning disable 3002
        // FXCOP: ExplicitMethodImplementationsInUnsealedClassesHaveVisibleAlternates
        // public versions of IXmlNamespaceResolver methods, so that XmlTextReader subclasses can access them
        public IDictionary<string,string> GetNamespacesInScope( XmlNamespaceScope scope ) {
            return impl.GetNamespacesInScope( scope );
        }
Example #40
0
		IDictionary IXmlNamespaceResolver.GetNamespacesInScope (XmlNamespaceScope scope)
		{
			return nsResolver != null ? nsResolver.GetNamespacesInScope (scope) : new Hashtable ();
		}
 // Internal IXmlNamespaceResolver methods
     internal IDictionary<string,string> GetNamespacesInScope( XmlNamespaceScope scope ) {
         return coreReaderNSResolver.GetNamespacesInScope( scope );
     }
Example #42
0
		public IDictionary<string,string> GetNamespacesInScope (
			XmlNamespaceScope scope)
		{
			return context.NamespaceManager.GetNamespacesInScope (scope);
		}
 IDictionary<string, string> IXmlNamespaceResolver.GetNamespacesInScope(XmlNamespaceScope scope)
 {
     throw NotImplemented.ByDesign;
 }
Example #44
0
		public IDictionary<string, string> GetNamespacesInScope (XmlNamespaceScope scope)
		{
			IXmlNamespaceResolver resolver = reader as IXmlNamespaceResolver;
			if (resolver == null)
				throw new NotSupportedException ("The input XmlReader does not implement IXmlNamespaceResolver and thus this validating reader cannot collect in-scope namespaces.");
			return resolver.GetNamespacesInScope (scope);
		}
		IDictionary<string, string> IXmlNamespaceResolver.GetNamespacesInScope (XmlNamespaceScope scope)
		{
			IXmlNamespaceResolver res = reader as IXmlNamespaceResolver;
			return res != null ? res.GetNamespacesInScope (scope) : new Dictionary<string, string> ();
		}
Example #46
0
 /// <summary>For a description of this member, see <see cref="M:System.Xml.IXmlNamespaceResolver.GetNamespacesInScope(System.Xml.XmlNamespaceScope)" />.</summary>
 /// <param name="scope"></param>
 IDictionary <string, string> IXmlNamespaceResolver.GetNamespacesInScope(XmlNamespaceScope scope)
 {
     return(((IHasXmlParserContext)this).ParserContext.NamespaceManager.GetNamespacesInScope(scope));
 }