Skip to content
Loading
  • Salman Beg
    0
    Hi. You can follow up with this link and in place of 5 you can put 50, https://stackoverflow.com/questions/17231446/select-top-5-records-from-xml-with-c-sharp
    0
  • Amit Mohanty
    0
    Convert response to xml.
    1. StreamReader ResponseDataStream = new StreamReader(response.GetResponseStream());  
    2. string res = ResponseDataStream.ReadToEnd();  
    3.   
    4. XmlDocument xmlDoc = new XmlDocument();  
    5. xmlDoc.LoadXml(res); 
    0
  • 0
    While converting it says XMLdocument doenot contain definition for GetResponseStream();
     
    response is a xmldocument. 
    0
  • Amit Mohanty
    0
    Hey Chandra Sekher if you are getting response as xml string then try this.
    1. XmlDocument xml = new XmlDocument();  
    2. xml.LoadXml(myXmlString); 
    0
  • Arun Kumar Tiwari
    0
    Try this:
     
    XmlDocument xml = new XmlDocument();
    xml.LoadXml(myXmlString);
    XmlNodeList xNodeList = xml.SelectNodes("/content/post[position() <= 50]");
     
    Now you can iterate over xNodeList to fetch particular value inside the post tag.
     
    You can also select TOP N records from data table then Linq will be better option
     
    dt.AsEnumerable().Take(5); 
    0
  • 0
    I have implemented the same but its not working
    0