0

Hi,

I am really new at ASP.NET, and I am wondering if there is a good way to extract XML attributes from ASP.NET. The example I am reading is here: http://www.w3schools.com/aspnet/aspnet_datalist.asp

Suppose I fix the XML snippet to:

<catalog>
<cd>
  <title>Eros</title>
  <artist country="EU">Eros Ramazzotti</artist>
  <company>BMG</company>
  <price>9.90</price>
  <year>1997</year>
</cd>
</catalog>

What should I change <%#Container.DataItem("artist")%> to in order to print out the country attribute?

Thanks for your help.

3
Contributors
3
Replies
4
Views
7 Years
Discussion Span
Last Post by ajwei810192
0
XmlDocument doc = new XmlDocument();
        doc.Load(Server.MapPath("~/XMLFile.xml"));

        XmlNodeList mynodes = doc.SelectNodes("article/body/page");
        
        foreach (XmlNode node in mynodes)
        {
            Response.Write(node.InnerText.ToString());
        }
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.