trades.xml

<?xml version="1.0" encoding="utf-8" ?>
<trades_sold_get_response>
<total_results>6195</total_results>
<trades>
<trade>
<adjust_fee>0.00</adjust_fee>
<buyer_nick>qeez654815</buyer_nick>
<buyer_obtain_point_fee>0</buyer_obtain_point_fee>
<buyer_rate>false</buyer_rate>
<cod_fee>0.00</cod_fee>
<cod_status>NEW_CREATED</cod_status>
<created>2017-04-27 13:24:40</created>
<discount_fee>0.00</discount_fee>
<modified>2017-04-27 13:26:56</modified>
<num>2</num>
<num_iid>140031040891</num_iid>
<orders>
<order>
<adjust_fee>0.00</adjust_fee>
<buyer_rate>false</buyer_rate>
<discount_fee>200.00</discount_fee>
<num>2</num>
<num_iid>410001030291</num_iid>
<oid>21436472253632370</oid>
<payment>718.00</payment>
<pic_path>https://img.alicdn.com/bao/uploaded/i5/TB16QtZRXXXXXaraFXXOlq7FFXX_094202.jpg</pic_path>
<price>459.00</price>
<refund_id>1332050232637026</refund_id>
<refund_status>WAIT_SELLER_AGREE</refund_status>
<seller_rate>false</seller_rate>
<seller_type>B</seller_type>
<sku_id>5239729466572</sku_id>
<sku_properties_name>套餐类型:七加波西米亚号一日游;出游人群:成人</sku_properties_name>
<status>WAIT_SELLER_SEND_GOODS</status>
<title>七加旅行 普吉岛蛋岛半日游 蜜月岛一日游鸡蛋岛亲子游 老少皆宜</title>
<total_fee>718.00</total_fee>
</order>
</orders>
<pay_time>2017-05-27 16:24:49</pay_time>
<payment>718.00</payment>
<pic_path>https://img.alicdn.com/bao/uploaded/i5/TB16QtZRXXXXXaraFXXOlq7FFXX_094202.jpg</pic_path>
<point_fee>0</point_fee>
<post_fee>0.00</post_fee>
<price>459.00</price>
<real_point_fee>0</real_point_fee>
<received_payment>0.00</received_payment>
<receiver_address>不需要收货地址</receiver_address>
<receiver_name>不*****</receiver_name>
<receiver_state></receiver_state>
<receiver_zip>000000</receiver_zip>
<seller_nick>武汉七加旅游专营店</seller_nick>
<seller_rate>false</seller_rate>
<shipping_type>free</shipping_type>
<sid>13436470353632670</sid>
<status>WAIT_SELLER_SEND_GOODS</status>
<tid>12326470353632670</tid>
<title>武汉七加旅游专营店</title>
<total_fee>918.00</total_fee>
<type>fixed</type>
</trade>
</trades>
<request_id>d3nt3rofd5sb</request_id>
</trades_sold_get_response>
<!--top011250241096.eu13-->


读取XML

using Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Script.Serialization;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Xml;
using Utility.Web;

namespace SasSystem
{
public partial class XmlFormat : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load(Server.MapPath("~/upload/trades.xml"));

XmlNode total_results = xmlDoc.SelectSingleNode("/trades_sold_get_response/total_results");
XmlNode request_id = xmlDoc.SelectSingleNode("/trades_sold_get_response/request_id");
Response.Write("total_results:" + total_results.InnerText + ";request_id:" + request_id.InnerText + "<br/>");

XmlNodeList trade = xmlDoc.SelectNodes("/trades_sold_get_response/trades/trade");
for (int i = 0; i < trade.Count; i++)
{
string adjust_fee = GetChildNodeText(trade[i], "adjust_fee");
string buyer_nick = GetChildNodeText(trade[i], "buyer_nick");
string buyer_obtain_point_fee = GetChildNodeText(trade[i], "buyer_obtain_point_fee");
string buyer_rate = GetChildNodeText(trade[i], "buyer_rate");
string cod_fee = GetChildNodeText(trade[i], "cod_fee");
string cod_status = GetChildNodeText(trade[i], "cod_status");
string consign_time = GetChildNodeText(trade[i], "consign_time");
string created = GetChildNodeText(trade[i], "created");
string discount_fee = GetChildNodeText(trade[i], "discount_fee");
string modified = GetChildNodeText(trade[i], "modified");
string num = GetChildNodeText(trade[i], "num");
string num_iid = GetChildNodeText(trade[i], "num_iid");
//string orders = "";
string pay_time = GetChildNodeText(trade[i], "pay_time");
string payment = GetChildNodeText(trade[i], "payment");
string pic_path = GetChildNodeText(trade[i], "pic_path");
string point_fee = GetChildNodeText(trade[i], "point_fee");
string post_fee = GetChildNodeText(trade[i], "post_fee");
string price = GetChildNodeText(trade[i], "price");
string real_point_fee = GetChildNodeText(trade[i], "real_point_fee");
string received_payment = GetChildNodeText(trade[i], "received_payment");
string receiver_address = GetChildNodeText(trade[i], "receiver_address");
string receiver_name = GetChildNodeText(trade[i], "receiver_name");
string receiver_state = GetChildNodeText(trade[i], "receiver_state");
string receiver_zip = GetChildNodeText(trade[i], "receiver_zip");
string seller_nick = GetChildNodeText(trade[i], "seller_nick");
string seller_rate = GetChildNodeText(trade[i], "seller_rate");
string shipping_type = GetChildNodeText(trade[i], "shipping_type");
string sid = GetChildNodeText(trade[i], "sid");
string status = GetChildNodeText(trade[i], "status");
string tid = GetChildNodeText(trade[i], "tid");
string title = GetChildNodeText(trade[i], "title");
string total_fee = GetChildNodeText(trade[i], "total_fee");
string type = GetChildNodeText(trade[i], "type");

Response.Write("adjust_fee:" + adjust_fee + " | buyer_nick:" + buyer_nick + " | buyer_obtain_point_fee:" + buyer_obtain_point_fee + " | buyer_rate:" + buyer_rate + "<br/>");
}


}

private static string GetChildNodeText(XmlNode node, string childnodename)
{
try
{
return node.SelectSingleNode(childnodename).InnerText;
}
catch (Exception)
{
return "";
}
}

}
}