コード例 #1
0
        /// <summary>
        /// 读取XML
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void testReadXmlBtn_Click(object sender, EventArgs e)
        {
            //读取XML方法一:节点名+属性名取值
            //string value = xml.SearchWords("student5", "姓名");
            //txtXML.AppendText(value + "\r\n");

            //读取XML方法二:已知属性名,属性值,然后获取其他属性值
            string[] values = xml.SearchWords("姓名", "张三", "学号");
            foreach (string item in values)
            {
                txtXML.AppendText(item);
            }
        }