HI,
I am not sure what exaclty you want to read from your file but here is a generic funtion for you that will read you xml data. You can also visit http://www.developer.com/net/csharp/article.php/3489611 to learn on how to manipulate xml data.
ReadNewsLetterXml(Server.MapPath("NewsLetter.xml"));
public void ReadNewsLetterXml(string path)
{
System.Xml.XmlDocument Document = new System.Xml.XmlDocument();
Document.Load(path);
if (Document.HasChildNodes)
{
// This line below will enable you to read your full xml file
ReadXmlNodes(Document.ChildNodes);
// Uncomment the line below if you want to read article nodes
// ReadXmlNodes(Document.SelectSingleNode("newsletter/items[@value='article']").ChildNodes);
// Uncomment the line below if you want to read comic nodes
// ReadXmlNodes(Document.SelectSingleNode("newsletter/items[@value='comics']").ChildNodes);
}
}
/// <summary>
/// This function will read the xmlnodelist selected
/// </summary>
/// <param name="nodeList"></param>
public void ReadXmlNodes(System.Xml.XmlNodeList nodeList)
{
foreach (System.Xml.XmlNode n in nodeList)
{
if (n.ChildNodes.Count == 0)
{
Response.Write(n.InnerText);
Response.Write("<br>");
}
else
{
if (n.Attributes.Count > 0)
{
Response.Write("<b>" + n.Attributes[0].Value + "</b><br>");
}
ReadXmlNodes(n.ChildNodes);
}
}
}