Extensible Markup Language XML

Source: Internet
Author: User

XML Overview:

: Extensible Markup Language

: XML is used to describe data

: XML is called Extensible Markup Language, which is used primarily to describe data

: XML nodes are case-sensitive, paired, and can be freely extended

Methods of manipulating XML (i)

1. Instantiate Document Object XMLDocument myXML =new XMLDocument (), parsing XML file class

2, Myxml.load ("Engineer.xml"); load the specified XML data

3, XmlNode engineer = myxml.documentelement; get root node

4, foreach (XmlNode node in engineer. ChildNodes) gets all the child nodes of the current node

{

Switch (node. Name) Current node name

{

Case "Name":

Console.WriteLine ("Name: {0}", node.) InnerText); The value of the current node

Break

Top down, row by line parsing

}

}

        

Ways to manipulate XML (ii)

: Traversing a child node under a child node through a double foreach loop

        

            : Direct output through the name of the child node

      TreeView Display Data (i)

TreeView Dynamic Add Node

      

          Tree Menu Expansion Method: Control name. ExpandAll ();

To delete a node:

this. The name of the control. Selectednode.remove ();

To empty a node:

this. The name of the control. SelectedNode.Nodes.Clear ();//empties all child nodes under the node

this. The name of the control. Node.clear ();//empties all nodes in the TreeView control

The method of emptying the tree menu is often used to update the top of the tree menu method so that the node is not loaded repeatedly

Summarize:

TreeView is used to display information with hierarchies

The TreeView main attributes are nodes and SelectedNode

TreeNode the Node object that represents the TreeView

The Text property is used to set the text description of the node

The Tag property can set node-related information

      

             

Extensible Markup Language XML

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.