以下は、XmlDocumentに読み込まれたXMLファイルです。
<Test xmlns="http://api.test.com/v2" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<Result id="2015" description="Invalid Token" />
</Test >
必要なのは、TextBoxに格納されている「id」属性値(「2015」)です。
これがXmlDocumentのロード方法です
XmlDocument updateUser = new XmlDocument();
updateUser.Load(response.GetResponseStream());
ここまでうまくいきます。
次に、名前空間を作成してノードを検索します
XmlNamespaceManager nsmgr = new XmlNamespaceManager(updateUser.NameTable);
nsmgr.AddNamespace("restup", "http://api.test.com/v2");
XmlNodeList locationElements1 = updateUser.SelectNodes("//restup:Test", nsmgr);
foreach (XmlNode Test in locationElements1)
{
//What DO I do here to get the value of 'id' attribute from the 'Result' node and save it in txtTest Textbox.
}