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


C# IXmlNode类代码示例

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


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


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