Getting Information from XML and displaying it on a UIWebView

Discussion in 'iOS Programming' started by ashwinr87, Oct 3, 2011.

  1. ashwinr87 macrumors member

    Joined:
    Mar 9, 2011
    #1
    I would like to know if there is a way to parse XML and display needed content on a UIWebView. Previously, I was using NSXMLParser to parse the XML and display it on a UITableView but the performance gets affected really badly when the XML has a huge chunk of data in it.

    It would be great if someone could help me out in this.
     
  2. anzio macrumors 6502

    Joined:
    Dec 5, 2010
    Location:
    Innisfil, Ontario, Canada
    #2
    Have you thought about parsing the data in the XML data and writing some simple HTML code (with loops, and arrays and what have you). Then call

    Code:
    NSString *html = [[NSString alloc]init];
    html = @"Insert your HTML code here (from parsed XML data)"
    [webView loadHTMLString:html baseURL:@"http://google.ca"];
    Either that, or generate an HTML file and save it in your apps bundle and replace items with those of what you received when you parsed the XML file.

    OR, are you asking about how to generate that HTML file?

    Is it possible for you to only list a certain number of items in the tableview, and allow the user to "Load more" when it becomes necessary? That might assist you with performance, while still maintaining an "iOS natural feel."
     

Share This Page