For quick EmpID, see following:
string xml = @"<div class=""details""><a href=""/Details/Empinfo.asp?empid=134"">Employee details</a></div>";
XmlDocument doc = new XmlDocument();
doc.LoadXml(xml);
string strEmpID = node.Attributes[@"href"].Value.ToString().Split(new char[] { '=' })[1];
Should you want all of the EmpIDs, then can do something like following:
private List<string> GetAllEmpIDs(string xml, string strTag/*Example: @"href" */, char[] caSplitBy, int nItemNumber /*second item in array, 1*/)
{
XmlDocument doc = new XmlDocument();
doc.LoadXml(xml);
List<string> lstEmpID = new List<string>();
foreach(XmlNode node in doc.DocumentElement.ChildNodes)
{
lstEmpID.Add(node.Attributes[strTag].Value.ToString().Split(caSplitBy)[nItemNumber]);
}
return lstEmpID;
}
Usage:
List<string> lstEmpID= GetAllEmpIDs(@"<div class=""details""><a href=""/Details/Empinfo.asp?empid=134"">Employee details</a></div>",
@"href",
new char[] { '=' },
1
);
Let me know, if above is of no help! (0: