Friday, April 17, 2009

amazom webservice get node name and node id ASP.NET c# , aws

string strname;
protected void Page_Load(object sender, EventArgs e)

{

XmlDocument doc = new XmlDocument();

doc.Load("http://ecs.amazonaws.com/onca/xml?Service=AWSECommerceService&AWSAccessKeyId=xxxxxx&Operation=BrowseNodeLookup&BrowseNodeId=374273011&ResponseGroup=BrowseNodeInfo");

XmlNodeList lstIsValid = doc.GetElementsByTagName("IsValid");

if (lstIsValid.Count > 0 && lstIsValid[0].InnerXml == "True")

{

XmlNodeList lstItems = doc.GetElementsByTagName("Children");

if (lstItems.Count > 0)

{

XmlNode nItem = lstItems[0];

foreach (XmlNode nChild in nItem.ChildNodes)

{

if (nChild.Name == "BrowseNode") //string compare !

{

// Response.Write(nChild["Name"].InnerText + "<br>");

// Response.Write(nChild["BrowseNodeId"].InnerText + "<br>");

//strname=strname+"<a href="+nChild["BrowseNodeId"].InnerText+"><"+ nChild["Name"].InnerText + "</a><br>";

strname = strname +

"<a href=" + nChild["BrowseNodeId"].InnerText + ">" + nChild["Name"].InnerText + "</a><br/>";

}

}

Response.Write(strname);

//Label1.Text = strname;

}

}

}

}


No comments: