static void Main(string[] args)
        {
            string strXml = @"<?xml version='1.0' encoding='utf-8' ?>
                    <root>
                    <MerchantID>1000</MerchantID>
                    <OrderID>mzo20151208162758</OrderID>
                    <Status>1</Status>
                    <TranInfo>成功</TranInfo>
                    <CardType>000701</CardType>
                    <Value>10</Value>
                    <Datetime>20151208171038</Datetime>
                    <TranOrder>201512081634311000855</TranOrder>
                    <Attach/>
                    <Sign>FB4D2101E05BC3822C089B09E0586086</Sign>
                    </root>
                    ";

            XmlDocument xx = new XmlDocument();
            xx.LoadXml(strXml);
            XmlNode xxNode = xx.SelectSingleNode("/root/Value");
            //Console.WriteLine(xxNode.InnerText);
            foreach (XmlNode xxNode2 in xxNode.ChildNodes)
            {
                if (xxNode2.Name == "Status")
                {
                    Console.WriteLine(xxNode2.Name + "---" + xxNode2.InnerText);
                }
            }
            Console.ReadKey();
        }

posted on 2016-04-22 00:50  renshen4322  阅读(161)  评论(0编辑  收藏  举报