Sunday, February 14, 2010

XML node parsing code snippet

Code snippet for parsing XML document :


if (providerDocument.ProviderCount > 0)
{
foreach (XmlNode xn in providerNodeList)
{
XmlNodeList xnlGroupOwned = xn.SelectNodes("xps:GroupOwned/xps:Type[contains(.,'LEA Area')]", providerDocument.NamespaceManager);
foreach (XmlNode xnGroupOwned in xnlGroupOwned)
{
XmlNodeList xnlGroupOwnedMember = xn.SelectNodes("xps:GroupOwned/xps:Member", providerDocument.NamespaceManager);
foreach (XmlNode xnGroupOwnedMember in xnlGroupOwnedMember)
{
upins.Append(xnGroupOwnedMember.ChildNodes.Item(2).FirstChild.InnerText + ",");
upinsTradingName.Append(xnGroupOwnedMember.ChildNodes.Item(2).LastChild.InnerText + "?");
}
XmlNodeList xnlFunding = xn.SelectNodes("xps:Funding", providerDocument.NamespaceManager);
foreach (XmlNode xnFunding in xnlFunding)
{
upinsFundingEligibility.Append(xnFunding.ChildNodes.Item(1).InnerText + ",");
}
}
}
}

No comments:

Post a Comment