Sgml reader for WP7

Sometimes you have to use html pages to get the data of that website in your application. For .net applications there was a great library http://developer.mindtouch.com/Community/SgmlReader to transform an html page to an XmlDocument / XDocument and makes it easy to get the data out. Unfortunately the library was not available for Windows Phone. I looked for an alternative but couldn’t find anything useful., lucky the source code was also avialable and I modified the code to be compatible with Windows Phone. I put the code on codeplex so you can easily use it in your projects to. The link is http://sgmlwp7.codeplex.com/

The api of the wp7 version didn’t changed so you can still use it by

 

XDocument FromHtml(TextReader reader) {

    // setup SGMLReader
    Sgml.SgmlReader sgmlReader = new Sgml.SgmlReader();
    sgmlReader.DocType = "HTML";
    sgmlReader.CaseFolding = Sgml.CaseFolding.ToLower;
    sgmlReader.InputStream = reader;

    // create document
    XDocument doc = XDocument.Load(sgmlReader);
    return doc;
}

Hope it helps!

  •   @VanMoof after ordering is it possible to somewhere look up status with eta?
  •   cute how @MicrosoftTeams restart due a glitch when you close the app... makes me wonder what they think the glitch… https://t.co/2TwilGiy1F
  •   Goodie incoming :)
  •   @danhellem @AzureDevOps awesome! :)
  •   @sandeepchads @AzureDevOps it's not there anymore; the morning i had the feature had a banner in the top of the page that had a button "try"
  •   @sandeepchads @AzureDevOps I had the feature yesterday morning on my environment and in the evening it was gone again 😭
  •   @markscholman @windowsdev Thanks! Jij ook!
  •   Another year @windowsdev MVP #MVPBuzz https://t.co/blu1TMBO0E
  •   RT @kevintgallo: Check it out https://t.co/F9exR1pQMx
  •   RT @stanzillaz: The new Windows Terminal is now on the Store https://t.co/n8rjsg19dv #WindowsInsiders