当前位置: 首页>>代码示例>>C#>>正文


C# XmlNamespaceScope类代码示例

本文整理汇总了C#中XmlNamespaceScope的典型用法代码示例。如果您正苦于以下问题:C# XmlNamespaceScope类的具体用法?C# XmlNamespaceScope怎么用?C# XmlNamespaceScope使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


XmlNamespaceScope类属于命名空间,在下文中一共展示了XmlNamespaceScope类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetNamespacesInScope

 internal IDictionary<string, string> GetNamespacesInScope(XmlNamespaceScope scope)
 {
     if (this.reader is IXmlNamespaceResolver)
     {
         return ((IXmlNamespaceResolver) this.reader).GetNamespacesInScope(scope);
     }
     return null;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:8,代码来源:XmlReaderDelegator.cs

示例2: GetNamespacesInScope

        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;
        }
开发者ID:pusp,项目名称:o2platform,代码行数:13,代码来源:Interfaces.cs

示例3:

		IDictionary<string, string> IXmlNamespaceResolver.GetNamespacesInScope (XmlNamespaceScope scope)
		{
			return ((IXmlNamespaceResolver) reader).GetNamespacesInScope (scope);
		}
开发者ID:nobled,项目名称:mono,代码行数:4,代码来源:XmlFilterReader.cs

示例4:

		///<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;
		}
开发者ID:95ulisse,项目名称:ILEdit,代码行数:20,代码来源:XmlBamlReader.cs

示例5:

//
// IXmlNamespaceResolver implementation
//
        IDictionary<string,string> IXmlNamespaceResolver.GetNamespacesInScope( XmlNamespaceScope scope ) {
            if ( !InNamespaceActiveState ) {
                return new Dictionary<string,string>();
            }
            return nsManager.GetNamespacesInScope( scope );
        }
开发者ID:gbarnett,项目名称:shared-source-cli-2.0,代码行数:9,代码来源:xmlsubtreereader.cs

示例6:

 IDictionary<string, string> IXmlNamespaceResolver.GetNamespacesInScope(XmlNamespaceScope scope)
 {
     return _nav.GetNamespacesInScope(scope);
 }
开发者ID:Corillian,项目名称:corefx,代码行数:4,代码来源:XPathNavigatorReader.cs

示例7: GetNamespacesInScope

		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;
		}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:19,代码来源:XPathNavigator.cs

示例8: GetNamespacesInScope

 // Internal IXmlNamespaceResolver methods
 internal IDictionary<string, string> GetNamespacesInScope(XmlNamespaceScope scope)
 {
     return _namespaceManager.GetNamespacesInScope(scope);
 }
开发者ID:chcosta,项目名称:corefx,代码行数:5,代码来源:XmlTextReaderImpl.cs

示例9:

		IDictionary<string, string> IXmlNamespaceResolver.GetNamespacesInScope (XmlNamespaceScope scope)
		{
			return nsResolver != null ? nsResolver.GetNamespacesInScope (scope) : 
				new Dictionary<string, string> ();
		}
开发者ID:user277,项目名称:mono,代码行数:5,代码来源:SubtreeXmlReader.cs

示例10: GetNamespacesInScope

 public System.Collections.Generic.IDictionary<string, string> GetNamespacesInScope (XmlNamespaceScope scope) {
     throw new NotImplementedException ();
 }
开发者ID:nhhoang,项目名称:shooting,代码行数:3,代码来源:AndroidManifestMerger.cs

示例11: GetNamespacesInScope

        // 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;
        }
开发者ID:shiftkey-tester,项目名称:corefx,代码行数:47,代码来源:XmlNamespaceManager.cs

示例12: GetNamespacesInScope

		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);
		}
开发者ID:nobled,项目名称:mono,代码行数:7,代码来源:XmlSchemaValidatingReader.cs

示例13: GetNamespacesInScope

 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;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:60,代码来源:XmlNodeReaderNavigator.cs

示例14: Hashtable

		IDictionary IXmlNamespaceResolver.GetNamespacesInScope (XmlNamespaceScope scope)
		{
			return nsResolver != null ? nsResolver.GetNamespacesInScope (scope) : new Hashtable ();
		}
开发者ID:nlhepler,项目名称:mono,代码行数:4,代码来源:SubtreeXmlReader.cs

示例15: GetNamespacesInScope

        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;
        }
开发者ID:noahfalk,项目名称:corefx,代码行数:37,代码来源:XPathNavigator.cs


注:本文中的XmlNamespaceScope类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。