Please note: If you find any post DOES NOT contain required amount of explanation, please do comment them with a request for more information. I will update as soon as I can attend to it. Also you can contact me with a link to the post.


Monday, June 16, 2008

XPathNodeIterator - Microsoft ASP.NET

XPathNodeIterator iterator = navigator.Select(
    "productData/categories/category[@name='category']/tariffs/tariff[@id='nn']/networks/network");
while (iterator.MoveNext())
{
    XPathNodeIterator products = 
        iterator.Current.Select("products/product"); 
    while (products.MoveNext()) 
    {
        XPathNavigator productNavigator = 
            products.Current; XPathNodeIterator prodDetails = 
                productNavigator.SelectDescendants(XPathNodeType.Text, false); 
                    String name, link; 
        while (prodDetails.MoveNext()) 
        {
            if (prodDetails.CurrentPosition == 1) name = prodDetails.Current.Value; 
                if (prodDetails.CurrentPosition == 2) link = prodDetails.Current.Value;
 
        } 
    /// utilize your strings here
    }
}
 

Copyrights(C) - Charith Gunasekara 2005-2010