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


C# IXmlNamespaceResolver.LookupNamespace方法代码示例

本文整理汇总了C#中System.Xml.IXmlNamespaceResolver.LookupNamespace方法的典型用法代码示例。如果您正苦于以下问题:C# IXmlNamespaceResolver.LookupNamespace方法的具体用法?C# IXmlNamespaceResolver.LookupNamespace怎么用?C# IXmlNamespaceResolver.LookupNamespace使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Xml.IXmlNamespaceResolver的用法示例。


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

示例1: WriteNamespaces

		public void WriteNamespaces (string defaultNamespace, NSResolver nsmgr, bool isData)
		{
			if (defaultNamespace == null)
				defaultNamespace = String.Empty;

			if (defaultNamespace.Length > 0)
				w.WriteLine ("default namespace = {0}",
					defaultNamespace);

			if (nsmgr != null) {
#if NET_2_0
				foreach (string s in nsmgr.GetNamespacesInScope (
					XmlNamespaceScope.All).Keys) {
#else
				foreach (string s in nsmgr) {
#endif
					switch (s) {
					case "xml":
					case "xmlns":
						continue;
					case "":
						if (defaultNamespace.Length > 0)
							w.WriteLine ("default namespace = '{0}'",
								nsmgr.LookupNamespace (s).Replace ('\'', '\"'));
						break;
					default:
						w.WriteLine ("{2} {0} = '{1}'",
							s,
							nsmgr.LookupNamespace (s).Replace ('\'', '\"'),
							isData ? "datatypes" : "namespace");
						break;
					}
				}
			}
			w.WriteLine ();
		}

		#region Elements
		// Note that it might not be used directly when a grammar
		// contains more than one "start" (compact syntax does not
		// support "combine" attribute).
		public void WriteStart (RelaxngStart start)
		{
			w.Write ("start");
			if (start.Combine == null)
				w.Write (" = ");
			else
				w.Write (start.Combine.Trim () == "interleave" ?
					" &= " : " |= ");
			start.Pattern.WriteRnc (this);
			w.WriteLine ();
		}
开发者ID:runefs,项目名称:Marvin,代码行数:52,代码来源:RncWriter.cs

示例2: GetInfo

		public override void GetInfo (out string name, out string ns, out XPathNodeType nodetype, NSResolver nsm)
		{
			// must be the correct node type
			nodetype = _axis.NodeType;
			
			if (_name.Name != "")
				name = _name.Name;
			else
				name = null;
			ns = "";
			if (nsm != null && _name.Namespace != "") {
				if (resolvedName)
					ns = _name.Namespace;
				else
					ns = nsm.LookupNamespace (_name.Namespace);	// TODO: check to see if this returns null or ""
				if (ns == null)
					throw new XPathException ("Invalid namespace prefix: "+_name.Namespace);
			}
		}
开发者ID:nobled,项目名称:mono,代码行数:19,代码来源:Expression.cs

示例3: Match

		public override bool Match (NSResolver nsm, XPathNavigator nav)
		{
			// must be the correct node type
			if (nav.NodeType != _axis.NodeType)
				return false;

			if (_name.Name != "")
			{
				// test the local part of the name first
				if (_name.Name != nav.LocalName)
					return false;
			}

			// get the prefix for the given name
			String strURI1 = "";
			if (_name.Namespace != "")
			{
				if (resolvedName)
					strURI1 = _name.Namespace;
				else if (nsm != null)
					strURI1 = nsm.LookupNamespace (_name.Namespace);
				if (strURI1 == null)
					throw new XPathException ("Invalid namespace prefix: "+_name.Namespace);
			}

			// test the prefixes
			return strURI1 == nav.NamespaceURI;
		}
开发者ID:nobled,项目名称:mono,代码行数:28,代码来源:Expression.cs

示例4: WriteNamespaces

		public void WriteNamespaces (string defaultNamespace, NSResolver nsmgr, bool isData)
		{
			if (defaultNamespace == null)
				defaultNamespace = String.Empty;

			if (defaultNamespace.Length > 0)
				w.WriteLine ("default namespace = {0}",
					defaultNamespace);

			if (nsmgr != null) {
				foreach (string s in nsmgr.GetNamespacesInScope (
					XmlNamespaceScope.All).Keys) {
					switch (s) {
					case "xml":
					case "xmlns":
						continue;
					case "":
						if (defaultNamespace.Length > 0)
							w.WriteLine ("default namespace = '{0}'",
								nsmgr.LookupNamespace (s).Replace ('\'', '\"'));
						break;
					default:
						w.WriteLine ("{2} {0} = '{1}'",
							s,
							nsmgr.LookupNamespace (s).Replace ('\'', '\"'),
							isData ? "datatypes" : "namespace");
						break;
					}
				}
			}
			w.WriteLine ();
		}
开发者ID:Profit0004,项目名称:mono,代码行数:32,代码来源:RncWriter.cs

示例5: GetInfo

		public override void GetInfo (out string name, out string ns, out XPathNodeType nodetype, NSResolver nsm)
		{
			// must be the correct node type
			nodetype = _axis.NodeType;
			
			if (_name.Name != "")
				name = _name.Name;
			else
				name = null;
			ns = "";
			if (nsm != null && _name.Namespace != "") {
				if (resolvedName)
					ns = _name.Namespace;
				else
// We still need to have such tricky switch, because the behavior is 
// inconsistent between .NET 1.x and 2.0 when the argument is not
// atomic string.
#if NET_2_0
					ns = nsm.LookupNamespace (_name.Namespace);	// TODO: check to see if this returns null or ""
#else
					ns = nsm.LookupNamespace (_name.Namespace, false);	// TODO: check to see if this returns null or ""
#endif
				if (ns == null)
					throw new XPathException ("Invalid namespace prefix: "+_name.Namespace);
			}
		}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:26,代码来源:Expression.cs

示例6: Match

		public override bool Match (NSResolver nsm, XPathNavigator nav)
		{
			// must be the correct node type
			if (nav.NodeType != _axis.NodeType)
				return false;

			if (_name.Name != "")
			{
				// test the local part of the name first
				if (_name.Name != nav.LocalName)
					return false;
			}

			// get the prefix for the given name
			String strURI1 = "";
			if (_name.Namespace != "")
			{
				if (resolvedName)
					strURI1 = _name.Namespace;
				else if (nsm != null)
// We still need to have such tricky switch, because the behavior is 
// inconsistent between .NET 1.x and 2.0 when the argument is not
// atomic string.
#if NET_2_0
					strURI1 = nsm.LookupNamespace (_name.Namespace);
#else
					strURI1 = nsm.LookupNamespace (_name.Namespace, false);
#endif
				if (strURI1 == null)
					throw new XPathException ("Invalid namespace prefix: "+_name.Namespace);
			}

			// test the prefixes
			return strURI1 == nav.NamespaceURI;
		}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:35,代码来源:Expression.cs


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