.net C# XML

Hi all, im new to .net and C# so i apologies if my code is not up to scratch, please feel free to make it better where you can, thats how we learn.

I have an xml file that i am looping through and pulling back all of a specific node, however, i want to only pull back one value where it is equal to an id passed on the url. I guess i have to put another if statement around what i already have but im not sure how to write it. Thank you for any help you may be able to give. This is what i have so far;


using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Xml;

public partial class secdetails : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        Label1.Text = Request.QueryString["id"];


{

	XmlTextReader XmlReader = new XmlTextReader(Server.MapPath("npt2011.xml"));


    string intID = Request.QueryString["id"];
	string strPrice = "";
	string strWeight = "";
	
	while (XmlReader.Read()) {
 
		if (XmlReader.Name.ToString() == "Sector/NPT") {
			if (XmlReader.HasAttributes) {
				while (XmlReader.MoveToNextAttribute()) {
					if (XmlReader.Name == "NPTCode") {
						intID = XmlReader.Value;
					}
				}
			}
		}

		if (XmlReader.Name.ToString() == "NPTName")strPrice = XmlReader.ReadString(); 
		if (XmlReader.Name.ToString() == "NPTEmail") strWeight = XmlReader.ReadString();
        if (XmlReader.Name.ToString() == "NPT" & XmlReader.NodeType.ToString() == "EndElement")
        {

            Response.Write("<p>npt: " + strPrice + "<br>");
            Response.Write("email: " + strWeight + "</p>");
            Response.Write("ID: " + intID + "</p>");


		}
	
	}
	
	XmlReader.Close();
		

}

        
    }

}




Try xpath. It was built for this sort of thing . . .