Web アプリケーションで AWS を使用しています。WS の応答を取得しました。
XML 応答:
<ItemSearchRespone xmlns="http:/....">
<Items>
<Item>
<ASIN>B003MC5N28</ASIN>
<DetailPageURL>http://www.amazon.com/Giver-Newbery-Medal-Book-ebook/dp/B003MC5N28%3FSubscriptionId%3DAKIAIETT7RP2RAFF4UUQ%26tag%3Dws%26linkCode%3Dxm2%26camp%3D2025%26creative%3D165953%26creativeASIN%3DB003MC5N28</DetailPageURL>
<SalesRank>469</SalesRank>
**<ItemAttributes>**
<Address>
<Country>us</Country>
</Address>
<Author>Lois Lowry</Author>
<Binding>Kindle Edition</Binding>
<Country>us</Country>
<Format>Kindle eBook</Format>
<Label>Houghton Mifflin Books for Children</Label>
<ListPrice>
<Amount>895</Amount>
<CurrencyCode>USD</CurrencyCode>
<FormattedPrice>$8.95</FormattedPrice>
</ListPrice>
<Manufacturer>Houghton Mifflin Books for Children</Manufacturer>
<NumberOfItems>1</NumberOfItems>
<NumberOfPages>204</NumberOfPages>
<ProductGroup>eBooks</ProductGroup>
<PublicationDate>1993-04-26</PublicationDate>
<Publisher>Houghton Mifflin Books for Children</Publisher>
<ReadingLevel>Young Adult</ReadingLevel>
<ReleaseDate>1993-04-26</ReleaseDate>
<Studio>Houghton Mifflin Books for Children</Studio>
<Title>The Giver (Newbery Medal Book)</Title>
**</ItemAttributes>**
</Item>
<Item> another item list2</Item>
<Item> another item list<3.../Item>
</Items>
</ItemSearchResponse>
ここでは、グリッド ビューですべての書籍のすべてのタイトル値と書式設定された価格を表示したいと考えています。
ここまでやってみた、
XmlDocument xdoc = new XmlDocument();
xdoc.Load(response.GetResponseStream());
XmlNamespaceManager ns = new XmlNamespaceManager(xdoc.NameTable);
ns.AddNamespace("ms", "http://webservices.amazon.com/AWSECommerceService/2005-10-05");
XmlNodeList xnl = xdoc.SelectNodes("//ms:Title", ns);
XmlNodeList xnl1 = xdoc.SelectNodes("//ms:FormattedPrice", ns);
DataTable dt=new DataTable();
dt.Columns.Add("Title",typeof(string));
dt.Columns.Add("Price", typeof(string));
foreach (XmlNode Title in xnl)
{
DataRow dr = dt.NewRow();
dr["Title"] = Title.InnerText;
dt.Rows.Add(dr);
}
GridView1.DataSource = dt;
GridView1.DataBind();
グリッド ビューで価格とタイトルの値を表示する方法は? ( Respone は、 title 、 Price 、 isbn などのノードが多数あります。さらに情報が必要な場合はお知らせください。
ありがとう。