zoukankan      html  css  js  c++  java
  • Linq to xml 小例

        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();
            }

  • 相关阅读:
    P1495 曹冲养猪
    luoguP4281[AHOI2008]紧急集合 / 聚会
    NOIP1997 代数表达式
    luogu P3709大爷的字符串题
    luoguP3912 素数个数
    POJ 1065 Wooden Sticks
    POJ 1063 Flip and Shift
    POJ 1062 昂贵的聘礼
    POJ 1003 Hangover
    POJ 1001 Exponentiation
  • 原文地址:https://www.cnblogs.com/renshen555/p/5419616.html
Copyright © 2011-2022 走看看