我要分析此XML,並獲得手機號碼從XML獲取價值?
<Result>
<text_message>
<id>4394</id>
<message>2</message>
<time>1373998420</time>
<message_phone>
<cellphone>09102805755</cellphone>
</message_phone>
</text_message>
</Result>
我的代碼是:這Rows[0][3]
int Num;
XDocument doc = XDocument.Parse(sms.InboxCheck(authsms, "1", "1", "0"));
doc.Save(Server.MapPath(".") + "\\xmlfolder\\xmlfile2.xml");
ds.ReadXml(Server.MapPath(".") + "\\xmlfolder\\xmlfile2.xml");
Num = Convert.ToInt32(ds.Tables["text_message"].Rows[0][3].ToString());
Label1.Text= Num.ToString();
價值0
我如何可以獲取手機號碼?
您試圖將XML讀入數據集而不將其解析爲XDocument的任何特定原因? –