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


C# XPathNavigator.CreateAttribute方法代码示例

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


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

示例1: SetOrCreateXmlAttribute

 public static void SetOrCreateXmlAttribute(XPathNavigator node, string localName, string namespaceURI, string value)
 {
     if (node.MoveToAttribute(localName, namespaceURI))
     {
         node.SetValue(value);
         node.MoveToParent();
     }
     else
     {
         node.CreateAttribute("", localName, namespaceURI, value);
     }
 }
开发者ID:neemask,项目名称:meta-core,代码行数:12,代码来源:CyphyMetaLinkUtils.cs

示例2: SetXmlType

		public void SetXmlType(string name, string namespaceUri, XPathNavigator source)
		{
			namespaceUri = GetEffectiveNamespace(namespaceUri);
			var prefix = CreateNamespace(null, namespaceUri, source);
			source.CreateAttribute("xsi", "type", Xsi, GetQualifiedName(prefix, name));
		}
开发者ID:n2cms,项目名称:Castle.Core,代码行数:6,代码来源:XPathContext.cs

示例3: CreateAttribute

		public XPathNavigator CreateAttribute(string name, string namespaceUri, XPathNavigator source)
		{
			source.CreateAttribute(null, name, namespaceUri, "");
			source.MoveToAttribute(name, namespaceUri ?? "");
			return source;
		}
开发者ID:n2cms,项目名称:Castle.Core,代码行数:6,代码来源:XPathContext.cs

示例4: CreateNamespace

		public string CreateNamespace(string prefix, string namespaceUri, XPathNavigator source)
		{
			if (string.IsNullOrEmpty(namespaceUri) == false)
			{
				source = source.Clone();
				source.MoveToRoot();
				source.MoveToChild(XPathNodeType.Element);

				if (string.IsNullOrEmpty(prefix))
					prefix = AddNamespace(namespaceUri);

				var existing = source.GetNamespace(prefix);
				if (existing == namespaceUri) return prefix;
				if (string.IsNullOrEmpty(existing) == false) return null;

				source.CreateAttribute("xmlns", prefix, "", namespaceUri);
			}
			return prefix;
		}
开发者ID:n2cms,项目名称:Castle.Core,代码行数:19,代码来源:XPathContext.cs

示例5: NormalizeNamespaces

        private static void NormalizeNamespaces(XPathNavigator src, XPathNavigator dest) {
            IDictionary<string, string> dictLocal = src.GetNamespacesInScope(XmlNamespaceScope.ExcludeXml);
            IDictionary<string, string> dictExclude = dest.GetNamespacesInScope(XmlNamespaceScope.Local);

            foreach(KeyValuePair<string, string> pair in dictLocal)
                if(!dictExclude.ContainsKey(pair.Key))
                    dest.CreateAttribute("xmlns", pair.Key, "http://www.w3.org/2000/xmlns/", pair.Value);
        }
开发者ID:NelsonSantos,项目名称:fyiReporting-Android,代码行数:8,代码来源:MakeXmlSignature.cs

示例6: MakeNil

		public bool MakeNil(XPathNavigator source)
		{
			if (source.NodeType == XPathNodeType.Element && IsNil(source) == false)
			{
				source.CreateAttribute("xsi", "nil", Xsi, "true");
				return true;
			}
			return false;
		}
开发者ID:Orvid,项目名称:NAntUniversalTasks,代码行数:9,代码来源:XPathContext.cs

示例7: CreateAttribute

		public XPathNavigator CreateAttribute(string name, string namespaceUri, XPathNavigator source)
		{
			name = XmlConvert.EncodeLocalName(name);
			source.CreateAttribute(null, name, namespaceUri, "");
			source.MoveToAttribute(name, namespaceUri ?? "");
			return source;
		}
开发者ID:Orvid,项目名称:NAntUniversalTasks,代码行数:7,代码来源:XPathContext.cs

示例8: MakeNil

		public bool MakeNil(XPathNavigator source)
		{
			if (source.NodeType == XPathNodeType.Element && IsNil(source) == false)
			{
				if (source.LookupPrefix(Xsi) != "xsi")
					CreateNamespace("xsi", Xsi, source);
				source.CreateAttribute("xsi", "nil", Xsi, "true");
				return true;
			}
			return false;
		}
开发者ID:Jarvin-Guan,项目名称:CleanAOP,代码行数:11,代码来源:XPathContext.cs

示例9: CreateAttribute

		public XPathNavigator CreateAttribute(string name, string namespaceUri, XPathNavigator source)
		{
			string prefix;
			name = XmlConvert.EncodeLocalName(name);
			if (IsRootNamespace(namespaceUri, out prefix))
				prefix = CreateNamespace(prefix, namespaceUri, source);
			source.CreateAttribute(prefix, name, namespaceUri, "");
			source.MoveToAttribute(name, namespaceUri ?? "");
			return source;
		}
开发者ID:Jarvin-Guan,项目名称:CleanAOP,代码行数:10,代码来源:XPathContext.cs

示例10: SetXmlStringAttributeValue

        public static bool SetXmlStringAttributeValue(XPathNavigator parentNode, string valueName, string newValue)
        {
            if (parentNode == null || string.IsNullOrEmpty(valueName))
            {
                return false;
            }
            try
            {
                XPathNavigator factory = parentNode.Clone();
                do
                {
                    factory.MoveToFirstAttribute();

                    if (string.Compare(factory.Name, valueName) == 0)
                    {
                        factory.SetValue(newValue);
                        return true;
                    }
                }
                while (!factory.MoveToNextAttribute());

                parentNode.CreateAttribute(string.Empty,
                                           valueName,
                                           string.Empty,
                                           newValue);
                return true;
            }
            catch (ArgumentNullException)
            {
            }
            catch (InvalidOperationException)
            {
            }
            return false;
        }
开发者ID:2594636985,项目名称:SharpDevelop,代码行数:35,代码来源:XmlHelperClass.cs


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