コード例 #1
0
 /// <summary>
 /// Adds child elements to this tree node.
 /// </summary>
 protected override void Initialize()
 {
     Nodes.Clear();
     foreach (XmlNode childNode in element.ChildNodes)
     {
         XmlElement childElement = childNode as XmlElement;
         XmlText    text         = childNode as XmlText;
         XmlComment comment      = childNode as XmlComment;
         if (childElement != null)
         {
             XmlElementTreeNode treeNode = new XmlElementTreeNode(childElement);
             treeNode.AddTo(this);
         }
         else if (text != null)
         {
             XmlTextTreeNode treeNode = new XmlTextTreeNode(text);
             treeNode.AddTo(this);
         }
         else if (comment != null)
         {
             XmlCommentTreeNode treeNode = new XmlCommentTreeNode(comment);
             treeNode.AddTo(this);
         }
     }
 }
コード例 #2
0
        /// <summary>
        /// Appends a new child element to the currently selected node.
        /// </summary>
        public void AppendChildElement(XmlElement element)
        {
            XmlElementTreeNode selectedNode = SelectedElementNode;

            if (selectedNode != null)
            {
                XmlElementTreeNode newNode = new XmlElementTreeNode(element);
                newNode.AddTo(selectedNode);
                selectedNode.Expand();
            }
        }
コード例 #3
0
		/// <summary>
		/// Adds child elements to this tree node.
		/// </summary>
		protected override void Initialize()
		{
			Nodes.Clear();
			foreach (XmlNode childNode in element.ChildNodes) {
				XmlElement childElement = childNode as XmlElement;
				XmlText text = childNode as XmlText;
				XmlComment comment = childNode as XmlComment;
				if (childElement != null) {
					XmlElementTreeNode treeNode = new XmlElementTreeNode(childElement);
					treeNode.AddTo(this);
				} else if (text != null) {
					XmlTextTreeNode treeNode = new XmlTextTreeNode(text);
					treeNode.AddTo(this);
				} else if (comment != null) {
					XmlCommentTreeNode treeNode = new XmlCommentTreeNode(comment);
					treeNode.AddTo(this);
				}
			}
		}
コード例 #4
0
        /// <summary>
        /// Displays the document in the xml tree.
        /// </summary>
        void ShowDocument()
        {
            Nodes.Clear();
            if (document != null)
            {
                foreach (XmlNode node in document.ChildNodes)
                {
                    switch (node.NodeType)
                    {
                    case XmlNodeType.Element:
                        XmlElementTreeNode elementNode = new XmlElementTreeNode((XmlElement)node);
                        elementNode.AddTo(this);
                        break;

                    case XmlNodeType.Comment:
                        XmlCommentTreeNode commentNode = new XmlCommentTreeNode((XmlComment)node);
                        commentNode.AddTo(this);
                        break;
                    }
                }
            }
        }
コード例 #5
0
		/// <summary>
		/// Displays the document in the xml tree.
		/// </summary>
		void ShowDocument()
		{
			Nodes.Clear();
			if (document != null) {
				foreach (XmlNode node in document.ChildNodes) {
					switch (node.NodeType) {
						case XmlNodeType.Element:
							XmlElementTreeNode elementNode = new XmlElementTreeNode((XmlElement)node);
							elementNode.AddTo(this);
							break;
						case XmlNodeType.Comment:
							XmlCommentTreeNode commentNode = new XmlCommentTreeNode((XmlComment)node);
							commentNode.AddTo(this);
							break;
					}
				}
			}
		}
コード例 #6
0
		/// <summary>
		/// Appends a new child element to the currently selected node.
		/// </summary>
		public void AppendChildElement(XmlElement element)
		{
			XmlElementTreeNode selectedNode = SelectedElementNode;
			if (selectedNode != null) {
				XmlElementTreeNode newNode = new XmlElementTreeNode(element);
				newNode.AddTo(selectedNode);
				selectedNode.Expand();
			}
		}