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


C# CompositeNode.AddChildNode方法代码示例

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


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

示例1: ProcessElement

		public Node ProcessElement(XElement startEl)
		{
			if (IsComplex(startEl))
			{
				CompositeNode top = new CompositeNode(startEl.Name.LocalName);
				foreach (var attr in startEl.Attributes())
				{
					var leaf = new LeafNode(typeof(String), attr.Name.LocalName, attr.Value);
					top.AddChildNode(leaf);
				}
				foreach (var childEl in startEl.Elements())
				{
					var childNode = ProcessElement(childEl);
					top.AddChildNode(childNode);
				}

				return top;
			}
			else
			{
				LeafNode top = new LeafNode(typeof(String), "", "");
				return top;
			}

			
		}
开发者ID:mgagne-atman,项目名称:Projects,代码行数:26,代码来源:XmlTreeBuilder.cs

示例2: PopulateTree

		/// <summary>
		/// 
		/// </summary>
		/// <param name="root"></param>
		/// <param name="reader"></param>
		/// <param name="prefix"></param>
		public void PopulateTree(CompositeNode root, IDataReader reader, String prefix)
		{
			string[] fields = GetFields(reader);

			int[] indexesToSkip = FindDuplicateFields(fields);
			
			IndexedNode indexNode = new IndexedNode(prefix);
			
			int row = 0;

			while(reader.Read())
			{
				CompositeNode node = new CompositeNode(row.ToString());

				for(int i=0; i<reader.FieldCount; i++)
				{
					// Is in the skip list?
					if (Array.IndexOf(indexesToSkip, i) >= 0) continue;
					
					// Is null?
					if (reader.IsDBNull(i)) continue;
					
					Type fieldType = reader.GetFieldType(i);
					
					node.AddChildNode(new LeafNode(fieldType, fields[i], reader.GetValue(i)));
				}

				indexNode.AddChildNode(node);
			
				row++;
			}
			
			root.AddChildNode(indexNode);
		}
开发者ID:nats,项目名称:castle-1.0.3-mono,代码行数:40,代码来源:DataReaderTreeBuilder.cs

示例3: BuildNode

		public CompositeNode BuildNode(XDocument doc)
		{
			var rootNode = new CompositeNode("root");
			rootNode.AddChildNode(ProcessElement(doc.Root));
			return rootNode;

		}
开发者ID:mgagne-atman,项目名称:Projects,代码行数:7,代码来源:XmlTreeBuilder.cs

示例4: GetParamsNode

		private static CompositeNode GetParamsNode(int expectedValue)
		{
			CompositeNode paramsNode = new CompositeNode("root");
			IndexedNode listNode = new IndexedNode("myList");
			paramsNode.AddChildNode(listNode);
			listNode.AddChildNode(new LeafNode(typeof(int), "", expectedValue));
			return paramsNode;
		}
开发者ID:nats,项目名称:castle-1.0.3-mono,代码行数:8,代码来源:GenericBindingTestCase.cs

示例5: GetOrCreateIndexedNode

		private IndexedNode GetOrCreateIndexedNode(CompositeNode parent, string nodeName)
		{
			Node node = parent.GetChildNode(nodeName);

			if (node != null && node.NodeType != NodeType.Indexed)
			{
				throw new BindingException("Attempt to create or obtain an indexed node " +
				                           "named {0}, but a node with the same exists with the type {1}", nodeName, node.NodeType);
			}

			if (node == null)
			{
				node = new IndexedNode(nodeName);
				parent.AddChildNode(node);
			}

			return (IndexedNode) node;
		}
开发者ID:gitter-badger,项目名称:Core-8,代码行数:18,代码来源:TreeBuilder.cs

示例6: AddLeafNode

		private void AddLeafNode(CompositeNode parent, Type type, String nodeName, object value)
		{
			parent.AddChildNode(new LeafNode(type, nodeName, value));
		}
开发者ID:gitter-badger,项目名称:Core-8,代码行数:4,代码来源:TreeBuilder.cs

示例7: AddToRoot

		public void AddToRoot(CompositeNode rootNode, XDocument doc)
		{
			var top = ProcessElement(doc.Root);
			rootNode.AddChildNode(top);
		}
开发者ID:mgagne-atman,项目名称:Projects,代码行数:5,代码来源:XmlTreeBuilder.cs


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