我对谅解有疑问,如何从XML读取数据。XML看起来像这样:
<PosXML version="7.2.0">
<ReadCardResponse>
<ReturnCode>1</ReturnCode>
<Card>
<Pan>222300******5062</Pan>
<Expires>****</Expires>
<CardName>MASTERCARD</CardName>
<CardSource>2</CardSource>
</Card>
</ReadCardResponse>
</PosXML>
我已经从流中加载了XML:
XDocument doc;
using (Stream responseStream = httpResponse.GetResponseStream())
{
doc= XDocument.Load(responseStream);
}
试过这个,但是不起作用:
XElement returnCode = doc.XPathSelectElement("ReturnCode")
一只萌萌小番薯
蝴蝶刀刀
相关分类