Hello,
I have a XML File that looks something like this.
<ItemList>
<ProductType>Google</ProductType>
<EmployeeName>John,X,Doe,jo******@domain.com</EmployeeName>
<EmployeeName>Jane,X,Doe,ja******@domain.com</EmployeeName>
<EmployeeName>Larry,X,Doe,la*******@domain.com</EmployeeName>
</ItemList>
What I am trying to accomplish is do an XPath Query that finds all
employees where the ProductType is swTitle.Text(Product Name that a
user enters into a form). But I want to display the result into a
datagrid with 4 columns ( FN, MI, LN, EMAIL ) so for example:
If some enters 'Google' the result will be the following style:
First Name MI Last Name Email
John X Doe jo******@domain.com
Jane X Doe ja******@domain.com
Larry X Doe la*******@domain.com
Here is the code that I am using:
void GetUserList()
{
XmlDocument doc = new XmlDocument();
doc.Load(Server.MapPath("software.xml"));
//XmlNode sw;
XmlNodeList sw;
XmlNode root = doc.DocumentElement;
// SEARCH XML FILE
string t = "'" + swTitle.Text + "'";
sw=root.SelectNodes("//EMPProductType[ProductType=" + t + "
]/EmployeeName");
int total = sw.Count;
// RETURN DATA FROM XPATH
if(sw != null)
{
for (int i=0; i < total; i++)
{
temp = temp + "<br> " + sw[i].OuterXml;
}
test.Text = temp;
usedCount.Text = total.ToString();
}
Any Help would be gratefull