Search code examples
androidwindows-phone-7portalsoftware-design

creating a smartphone client for windows phone 7 or android


I'm trying to design an android or windows phone 7 app (a client) that would fetch the news from a website, that website doesn't provide an api or xml files.

My question is, whats the best way to do that? Should I just download the html file and parse its content? Am sorry if my questions is a little vague, but am not asking for code. I need some guidelines or approaches to do that.

Note: I wont violate any copyrights, am just creating a portal for my University website.


Solution

  • If Windows 7, there is a version of the HtmlAgility Pack for WP7.

    Here is a bit of sample code:

    public void Hap()
    {
        HtmlWeb.LoadAsync("http://www.mycollege.edu/news", OnCallback);           
    }
    
    private void OnCallback(object s, HtmlDocumentLoadCompleted htmlDocumentLoadCompleted)
    {    
        var htmlDocument = htmlDocumentLoadCompleted.Document;
        //use agilitypack to parse out news    
    }
    

    Another approach is to have a service of some sort actually do the scraping and management of the news data then you control the format that the mobile devices consume like XML or JSON.