110,535
社区成员
发帖
与我相关
我的任务
分享
<marketlive xmlns="http://marketlive.com/integration/xmlbean">
<results>
<info>
<timeStamp>Fri Mar 02 10:03:03 PST 2012</timeStamp>
<site>jessicasimpson</site>
<environment>production</environment>
<vmType/>
<host/>
<vmId>jessicasimpson-prod-iws1</vmId>
<systemLocale>en</systemLocale>
<driver>oracle.jdbc.driver.OracleDataSource</driver>
<dbUrl>jdbc:oracle:thin:@10.100.3.60:1523:SAPRD7G1</dbUrl>
</info>
<result>
<output>
<orders>
<order pk="107101">
<code>ML_107101</code>
<dateCreated>2012-03-02T09:37:13.889-08:00</dateCreated>
<dateModified>2012-03-02T09:37:13.924-08:00</dateModified>
<siteCode>jessicasimpson</siteCode>
<locale>en_US</locale>
<customerCode>ML_180988</customerCode>
<status>Ordered</status>
<subTotal>88.20</subTotal>
<taxTotal>0.00</taxTotal>
<shippingTotal>22.00</shippingTotal>
<shippingCostTotal>7.00</shippingCostTotal>
<shippingMethodTotal>15.00</shippingMethodTotal>
<shippingWeightTotal>0.00</shippingWeightTotal>
<shippingLocationTotal>0.00</shippingLocationTotal>
<giftWrapTotal>0.00</giftWrapTotal>
<additionalAddressTotal>0.00</additionalAddressTotal>
<additionalChargesTotal>0.00</additionalChargesTotal>
<weightSurchargeTotal>0.00</weightSurchargeTotal>
<total>110.20</total>
<merchandiseTotal>98.00</merchandiseTotal>
<deferred>false</deferred>
<multipleAddresses>false</multipleAddresses>
<sourceCodesAsString>WELCOME10*|*</sourceCodesAsString>
<deleted>false</deleted>
<dateOrdered>2012-03-02T09:37:13.888-08:00</dateOrdered>
<billToInfo pk="107502">
<code>ML_107502</code>
<dateCreated>2012-03-02T09:37:13.888-08:00</dateCreated>
<dateModified>2012-03-02T09:37:13.888-08:00</dateModified>
<attributePages>
<attributePage>
<name>person</name>
<attributes>
<firstName>Brandi</firstName>
<lastName>Pharr</lastName>
</attributes>
</attributePage>
<attributePage>
<name>address</name>
<attributes>
<street1>293 Marion Place</street1>
<postOfficeBox>false</postOfficeBox>
<city>Merritt Island</city>
<state>FL</state>
<country>US</country>
<postalCode>32953</postalCode>
</attributes>
</attributePage>
</attributePages>
<phone1>3214463699</phone1>
<email>bpharr21@yahoo.com</email>
</billToInfo>
<shipments>
<orderShipment pk="107101">
<code>ML_107101</code>
<dateCreated>2012-03-02T09:37:13.842-08:00</dateCreated>
<shipToInfo pk="107501">
<code>ML_107501</code>
<dateCreated>2012-03-02T09:37:13.796-08:00</dateCreated>
<dateModified>2012-03-02T09:37:13.796-08:00</dateModified>
<attributePages>
<attributePage>
<name>person</name>
<attributes>
<firstName>Brandi</firstName>
<lastName>Pharr</lastName>
</attributes>
</attributePage>
<attributePage>
<name>address</name>
<attributes>
<street1>293 Marion Place</street1>
<postOfficeBox>false</postOfficeBox>
<city>Merritt Island</city>
<state>FL</state>
<country>US</country>
<postalCode>32953</postalCode>
</attributes>
</attributePage>
</attributePages>
<phone1>3214463699</phone1>
<email>bpharr21@yahoo.com</email>
</shipToInfo>
<status>Ordered</status>
<shippingMethodCode>UPS1DY</shippingMethodCode>
<shippingMethodName>UPS Next Day</shippingMethodName>
<shippingMethodDescription>All orders placed by 10AM PST will arrive Next Business Day.</shippingMethodDescription>
<subTotal>98.00</subTotal>
<total>120.00</total>
<shippingTotal>22.00</shippingTotal>
<shippingCostTotal>7.00</shippingCostTotal>
<shippingMethodTotal>15.00</shippingMethodTotal>
<shippingWeightTotal>0.00</shippingWeightTotal>
<taxTotal>0.00</taxTotal>
<giftWrapTotal>0.00</giftWrapTotal>
<additionalChargesTotal>0.00</additionalChargesTotal>
<weightSurchargeTotal>0.00</weightSurchargeTotal>
<merchandiseTotal>98.00</merchandiseTotal>
<deleted>false</deleted>
<items>
<orderItem pk="107201">
<code>ML_107201</code>
<dateCreated>2012-03-02T09:37:13.842-08:00</dateCreated>
<categoryCode>C2-Sub Category 1</categoryCode>
<productCode>CATHI</productCode>
<productName>CATHI</productName>
<status>Ordered</status>
<regularPrice>98.00</regularPrice>
<sellPrice>98.00</sellPrice>
<subTotal>98.00</subTotal>
<qty>1</qty>
<ordinal>0</ordinal>
<sku>CATHIJV2811800</sku>
<skuPk>107437</skuPk>
<overWeight>false</overWeight>
<giftCertificate>false</giftCertificate>
<options>6,NATURAL COMBO</options>
<optionNames>6,Natural Combo</optionNames>
<freeGift>false</freeGift>
<kitPart>false</kitPart>
</orderItem>
</items>
</orderShipment>
</shipments>
<discounts>
<discount>
<message>10% Off Discount has been applied</message>
<amount>9.80</amount>
<pricingName>10% OFF</pricingName>
<sourceCodesAsString>WELCOME10*|*</sourceCodesAsString>
</discount>
</discounts>
</order>
</orders>
</output>
<summary>
<total>3</total>
<failed>0</failed>
</summary>
</result>
</results>
</marketlive>
static void Main(string[] args)
{
List<XmlNode> list = new List<XmlNode>();
XmlDocument xml = new XmlDocument();
xml.Load(@"E:\a.xml");
XmlNamespaceManager xns = new XmlNamespaceManager(xml.NameTable);
xns.AddNamespace("a", "http://marketlive.com/integration/xmlbean");
XmlNodeList node = xml.SelectNodes("//a:orders/a:order", xns);
foreach (XmlNode n in node)
{
ResponseText(n.ChildNodes, list);
}
Console.WriteLine(new string('*', 20));
foreach (XmlNode n in list)
{
Console.WriteLine("{0}的所有子节点值", n.Name);
ResponseText(n.ChildNodes);
Console.WriteLine(new string('*', 20));
}
Console.ReadLine();
}
protected static void ResponseText(XmlNodeList node, List<XmlNode> list)
{
foreach (XmlNode n in node)
{
if (n.HasChildNodes && n.FirstChild.NodeType != XmlNodeType.Text)
{
list.Add(n);
}
else
Console.WriteLine(n.InnerText);
}
}
protected static void ResponseText(XmlNodeList node)
{
foreach (XmlNode n in node)
{
if (n.HasChildNodes && n.FirstChild.NodeType != XmlNodeType.Text)
ResponseText(n.ChildNodes);
else
Console.WriteLine(n.InnerText);
}
}
/*
ML_107101
2012-03-02T09:37:13.889-08:00
2012-03-02T09:37:13.924-08:00
jessicasimpson
en_US
ML_180988
Ordered
88.20
0.00
22.00
7.00
15.00
0.00
0.00
0.00
0.00
0.00
0.00
110.20
98.00
false
false
WELCOME10*|*
false
2012-03-02T09:37:13.888-08:00
********************
billToInfo的所有子节点值
ML_107502
2012-03-02T09:37:13.888-08:00
2012-03-02T09:37:13.888-08:00
person
Brandi
Pharr
address
293 Marion Place
false
Merritt Island
FL
US
32953
3214463699
bpharr21@yahoo.com
********************
shipments的所有子节点值
ML_107101
2012-03-02T09:37:13.842-08:00
ML_107501
2012-03-02T09:37:13.796-08:00
2012-03-02T09:37:13.796-08:00
person
Brandi
Pharr
address
293 Marion Place
false
Merritt Island
FL
US
32953
3214463699
bpharr21@yahoo.com
Ordered
UPS1DY
UPS Next Day
All orders placed by 10AM PST will arrive Next Business Day.
98.00
120.00
22.00
7.00
15.00
0.00
0.00
0.00
0.00
0.00
98.00
false
ML_107201
2012-03-02T09:37:13.842-08:00
C2-Sub Category 1
CATHI
CATHI
Ordered
98.00
98.00
98.00
1
0
CATHIJV2811800
107437
false
false
6,NATURAL COMBO
6,Natural Combo
false
false
********************
discounts的所有子节点值
10% Off Discount has been applied
9.80
10% OFF
WELCOME10*|*
********************
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;
using System.IO;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
XmlDocument xmlDoc = new XmlDocument();//实例化XmlDocument
string xmlFile = HelperClass.GetFiles(new DirectoryInfo(System.IO.Directory.GetCurrentDirectory()), "*.xml");
xmlDoc.Load(xmlFile);//加载xml文档
XmlNamespaceManager xns = new XmlNamespaceManager(xmlDoc.NameTable);
xns.AddNamespace("a", "http://marketlive.com/integration/xmlbean");
XmlNode node = xmlDoc.SelectSingleNode("//a:orders", xns);
ResponseText(node.ChildNodes);
Console.ReadLine();
}
protected static void ResponseText(XmlNodeList node)
{
foreach (XmlNode n in node)
{
if (n.HasChildNodes)
{
ResponseText(n.ChildNodes);
}
else
{
Console.WriteLine(n.InnerText);
}
}
}
}
}
static void Main(string[] args)
{
List<XmlNode> list = new List<XmlNode>();
XmlDocument xml = new XmlDocument();
xml.Load(@"E:\a.xml");
XmlNamespaceManager xns = new XmlNamespaceManager(xml.NameTable);
xns.AddNamespace("a", "http://marketlive.com/integration/xmlbean");
XmlNodeList node = xml.SelectNodes("//a:orders/a:order", xns);
foreach (XmlNode n in node)
{
ResponseText(n.ChildNodes, list);
Console.WriteLine(new string('*', 20));
foreach (XmlNode nn in list)
{
Console.WriteLine("{0}的所有子节点值", nn.Name);
ResponseText(nn.ChildNodes);
Console.WriteLine(new string('*', 20));
list = new List<XmlNode>();
}
}
Console.ReadLine();
}