• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# IXmlNode类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: SetValue

		public override void SetValue(IXmlNode node, IDictionaryAdapter parent, IXmlAccessor accessor, ref object value)
		{
			var source      = (Array) value;
			var target      = (Array) null;
			var itemType    = source.GetType().GetElementType();
			var subaccessor = accessor.GetCollectionAccessor(itemType);
			var cursor      = subaccessor.SelectCollectionItems(node, true);
			var serializer  = subaccessor.Serializer;
			var references  = XmlAdapter.For(parent).References;

			for (var i = 0; i < source.Length; i++)
			{
				var originalItem = source.GetValue(i);
				var assignedItem = originalItem;

				subaccessor.SetValue(cursor, parent, references, cursor.MoveNext(), null /* TODO: Get Value */, ref assignedItem);

				if (target != null)
				{
					target.SetValue(assignedItem, i);
				}
				else if (!Equals(assignedItem, originalItem))
				{
					target = Array.CreateInstance(itemType, source.Length);
					Array.Copy(source, target, i);
					target.SetValue(assignedItem, i);
				}
			}

			cursor.RemoveAllNext();

			if (target != null)
				value = target;
		}
开发者ID:radiy,项目名称:Core,代码行数:34,代码来源:XmlArraySerializer.cs


示例2: GetValue

		public override object GetValue(IXmlNode node, IDictionaryAdapter parent, IXmlAccessor accessor)
		{
            using (var reader = new XmlSubtreeReader(node, Root))
                return serializer.CanDeserialize(reader)
                    ? serializer.Deserialize(reader)
                    : null;
		}
开发者ID:elevine,项目名称:Core,代码行数:7,代码来源:XmlDefaultSerializer.cs


示例3: SelectPropertyNode

		public override IXmlCursor SelectPropertyNode(IXmlNode node, bool mutable)
		{
			var flags = Serializer.Kind == XmlTypeKind.Simple
				? CursorFlags.AllNodes
				: CursorFlags.Elements;
			return node.SelectChildren(KnownTypes, Context, flags.MutableIf(mutable));
		}
开发者ID:gitter-badger,项目名称:MobileMoq,代码行数:7,代码来源:XmlDefaultBehaviorAccessor.cs


示例4: SetValue

		public override void SetValue(IXmlNode node, IDictionaryAdapter parent, IXmlAccessor accessor, object oldValue, ref object value)
		{
			if (node.ClrType != typeof(object))
				XmlTypeSerializer.For(node.ClrType).SetValue(node, parent, accessor, oldValue, ref value);
			else
				node.Clear();
		}
开发者ID:leloulight,项目名称:Core,代码行数:7,代码来源:XmlDynamicSerializer.cs


示例5: GetValueCore

		private object GetValueCore(IXmlNode node, IDictionaryAdapter parent, IXmlAccessor accessor)
		{
			var itemType    = node.ClrType.GetGenericArguments()[0];
			var listType    = ListTypeConstructor.MakeGenericType(itemType);
			var subaccessor = accessor.GetCollectionAccessor(itemType);
			return Activator.CreateInstance(listType, node, parent, subaccessor);
		}
开发者ID:leloulight,项目名称:Core,代码行数:7,代码来源:XmlCollectionSerializer.cs


示例6: PushParentNamespaces

 private void PushParentNamespaces(IXmlNode node, XmlNamespaceManager manager)
 {
   List<IXmlNode> list = (List<IXmlNode>) null;
   IXmlNode xmlNode1 = node;
   while ((xmlNode1 = xmlNode1.ParentNode) != null)
   {
     if (xmlNode1.NodeType == XmlNodeType.Element)
     {
       if (list == null)
         list = new List<IXmlNode>();
       list.Add(xmlNode1);
     }
   }
   if (list == null)
     return;
   list.Reverse();
   foreach (IXmlNode xmlNode2 in list)
   {
     manager.PushScope();
     foreach (IXmlNode xmlNode3 in (IEnumerable<IXmlNode>) xmlNode2.Attributes)
     {
       if (xmlNode3.NamespaceUri == "http://www.w3.org/2000/xmlns/" && xmlNode3.LocalName != "xmlns")
         manager.AddNamespace(xmlNode3.LocalName, xmlNode3.Value);
     }
   }
 }
开发者ID:Zeludon,项目名称:FEZ,代码行数:26,代码来源:XmlNodeConverter.cs


示例7: SetValue

		public override void SetValue(IXmlNode node, IDictionaryAdapter parent, IXmlAccessor accessor, object oldValue, ref object value)
		{
			var newNode = (XmlNode) value;

			using (var writer = new XmlSubtreeWriter(node))
				newNode.WriteTo(writer);
		}
开发者ID:leloulight,项目名称:Core,代码行数:7,代码来源:XmlXmlNodeSerializer.cs


示例8: XmlSubtreeWriter

        public XmlSubtreeWriter(IXmlNode node)
        {
            if (node == null)
                throw Error.ArgumentNull("node");

            this.node = node;
        }
开发者ID:jeremymeng,项目名称:Core,代码行数:7,代码来源:XmlSubtreeWriter.cs


示例9: ParsePartwise

        private void ParsePartwise(IXmlNode element)
        {
            var version = element.GetAttribute("version");
            if (!string.IsNullOrEmpty(version) && version != "2.0")
            {
                throw new UnsupportedFormatException();
            }

            element.IterateChildren(c =>
            {
                if (c.NodeType == XmlNodeType.Element)
                {
                    switch (c.LocalName)
                    {
                        case "movement-title":
                            _score.Title = Std.GetNodeValue(c.FirstChild);
                            break;
                        case "identification":
                            ParseIdentification(c);
                            break;
                        case "part-list":
                            ParsePartList(c);
                            break;
                        case "part":
                            ParsePart(c);
                            break;
                    }
                }
            });
        }
开发者ID:eriser,项目名称:alphaTab,代码行数:30,代码来源:MusicXml2Importer.cs


示例10: Parse

        public static XmlRpcValue Parse(IXmlNode node)
        {
            switch (node.NodeName.ToLower())
            {
                case "array":
                    return new XmlRpcArray(node);
                    break;
                case "struct":
                    return new XmlRpcStruct(node);
                    break;
                case "boolean":
                    return new XmlRpcBoolean(node);
                    break;
                case "int":
                    return new XmlRpcInt(node);
                    break;
                case "i4":
                    return new XmlRpcInt(node);
                    break;
                case "double":
                    return new XmlRpcDouble(node);
                    break;
                case "datetime.iso8601":
                    return new XmlRpcDateTime(node);
                    break;
                default:
                    return new XmlRpcString(node);
            }

            return null;
        }
开发者ID:edandersen,项目名称:xmlrpc.universal,代码行数:31,代码来源:XmlRpcParser.cs


示例11: PopulateIdentity

		private void PopulateIdentity(int id, IXmlNode node)
		{
			Entry entry;
			if (!entriesById.TryGetValue(id, out entry))
				entriesById.Add(id, new Entry(id, node));
			if (nextId <= id)
				nextId = ++id;
		}
开发者ID:elevine,项目名称:Core,代码行数:8,代码来源:XmlReferenceManager.cs


示例12: GetValue

		public override object GetValue(IXmlNode node, IDictionaryAdapter parent, IXmlAccessor accessor)
		{
			var source = node.AsRealizable<XmlNode>();

			return (source != null && source.IsReal)
				? source.Value
				: null;
		}
开发者ID:leloulight,项目名称:Core,代码行数:8,代码来源:XmlXmlNodeSerializer.cs


示例13: XmlRpcDouble

        public XmlRpcDouble(IXmlNode node)
        {
            double val = -1;

            double.TryParse(node.InnerText, out val);

            Value = val;
        }
开发者ID:edandersen,项目名称:xmlrpc.universal,代码行数:8,代码来源:XmlRpcDouble.cs


示例14: ResolveFullName

 private string ResolveFullName(IXmlNode node, XmlNamespaceManager manager)
 {
   string str = node.NamespaceUri == null || node.LocalName == "xmlns" && node.NamespaceUri == "http://www.w3.org/2000/xmlns/" ? (string) null : manager.LookupPrefix(node.NamespaceUri);
   if (!string.IsNullOrEmpty(str))
     return str + ":" + node.LocalName;
   else
     return node.LocalName;
 }
开发者ID:Zeludon,项目名称:FEZ,代码行数:8,代码来源:XmlNodeConverter.cs


示例15: PopulateReference

		private void PopulateReference(int id, IXmlNode node, ICollection<Reference> references)
		{
			Entry entry;
			if (entriesById.TryGetValue(id, out entry))
				entry.AddReference(node);
			else
				references.Add(new Reference(id, node));
		}
开发者ID:elevine,项目名称:Core,代码行数:8,代码来源:XmlReferenceManager.cs


示例16: XmlReferenceManager

		public XmlReferenceManager(IXmlNode root, IXmlReferenceFormat format)
		{
			entriesById    = new        Dictionary<int,    Entry>();
			entriesByValue = new WeakKeyDictionary<object, Entry>(ReferenceEqualityComparer<object>.Instance);
			this.format    = format;
			this.nextId    = 1;

			Populate(root);
		}
开发者ID:elevine,项目名称:Core,代码行数:9,代码来源:XmlReferenceManager.cs


示例17: AddSuggestionFromNode

        private void AddSuggestionFromNode(IXmlNode node, SearchSuggestionCollection suggestions)
        {
            string text = "";
            string description = "";
            string url = "";
            string imageUrl = "";
            string imageAlt = "";

            foreach (IXmlNode subNode in node.ChildNodes)
            {
                if (subNode.NodeType != NodeType.ElementNode)
                {
                    continue;
                }
                if (subNode.NodeName.Equals("Text", StringComparison.CurrentCultureIgnoreCase))
                {
                    text = subNode.InnerText;
                }
                else if (subNode.NodeName.Equals("Description", StringComparison.CurrentCultureIgnoreCase))
                {
                    description = subNode.InnerText;
                }
                else if (subNode.NodeName.Equals("Url", StringComparison.CurrentCultureIgnoreCase))
                {
                    url = subNode.InnerText;
                }
                else if (subNode.NodeName.Equals("Image", StringComparison.CurrentCultureIgnoreCase))
                {
                    if (subNode.Attributes.GetNamedItem("source") != null)
                    {
                        imageUrl = subNode.Attributes.GetNamedItem("source").InnerText;
                    }
                    if (subNode.Attributes.GetNamedItem("alt") != null)
                    {
                        imageAlt = subNode.Attributes.GetNamedItem("alt").InnerText;
                    }
                }
            }

            if (string.IsNullOrWhiteSpace(text))
            {
                // No proper suggestion item exists
            }
            else if (string.IsNullOrWhiteSpace(url))
            {
                suggestions.AppendQuerySuggestion(text);
            }
            else
            {
                // The following image should not be used in your application for Result Suggestions.  Replace the image with one that is tailored to your content
                Uri uri = string.IsNullOrWhiteSpace(imageUrl) ? new Uri("ms-appx:///Assets/SDK_ResultSuggestionImage.png") : new Uri(imageUrl);
                RandomAccessStreamReference imageSource = RandomAccessStreamReference.CreateFromUri(uri);
                suggestions.AppendResultSuggestion(text, description, url, imageSource, imageAlt);
                Debug.WriteLine("\n                   Search Result ({0}): {1}", text, description);
            }
        }
开发者ID:henriquetomaz,项目名称:win8-samples,代码行数:56,代码来源:XMLSearch.xaml.cs


示例18: SetNodeValueString

        static void SetNodeValueString(string str, IXmlDocument xmldoc, IXmlNode node) {
            IXmlText textNode;
            int res = xmldoc.CreateTextNode(str, out textNode);
            ComFunctions.CheckHRESULT(res);

            IXmlNode textNodeAsNode = (IXmlNode)textNode;
            IXmlNode appendedChild;
            res = node.AppendChild(textNodeAsNode, out appendedChild);
            ComFunctions.CheckHRESULT(res);
        }
开发者ID:JustGitHubUser,项目名称:DevExpress.Mvvm.Free,代码行数:10,代码来源:ToastNotificationContent.cs


示例19: Populate

		private void Populate(IXmlNode node)
		{
			var references = new List<Reference>();
			var iterator   = node.SelectSubtree();

			while (iterator.MoveNext())
				PopulateFromNode(iterator, references);

			PopulateDeferredReferences(references);
		}
开发者ID:elevine,项目名称:Core,代码行数:10,代码来源:XmlReferenceManager.cs


示例20: XmlSubtreeReader

        public XmlSubtreeReader(IXmlNode node, string rootLocalName, string rootNamespaceUri)
        {
            if (null == node)
                throw Error.ArgumentNull("node");
            if (null == rootLocalName)
                throw Error.ArgumentNull("rootLocalName");

            this.reader           = node.ReadSubtree();
            this.rootLocalName    = reader.NameTable.Add(rootLocalName);
			this.rootNamespaceURI = rootNamespaceUri ?? string.Empty;
        }
开发者ID:leloulight,项目名称:Core,代码行数:11,代码来源:XmlSubtreeReader.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IXmlQuest类代码示例发布时间:2022-05-24
下一篇:
C# IXmlNamespaceResolver类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap