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!

  •   RT @windowsblog: Windows Template Studio 1.1 released! https://t.co/qCLpESAvnB
  •   @JenMsft and does sqrt(4) - 2 gives now the right awnser?
  •   @Alex_A_Simons any updates on that what more is happening ? (2/2)
  •   @Alex_A_Simons long time ago you said the mess between msa and aad's would be fixed; first step was block to create msa on aad account. (1/2
  •   First pullrequest for https://t.co/5lEHH630Io :)
  •   @qmatteoq whosdown is great alternative for whatapps and comes from the store
  •   @jvintzel only for windows 10 s users or can other surface users get it too?
  •   RT @JenMsft: O hi there @Spotify 😊 #Windows10 https://t.co/nlJUgM7vVG https://t.co/boah802WgZ
  •   RT @tvgrimbergen: Awesome! Just extended our @MicrosoftTeams bot. Provide natural language input to initiate a leave request powered by @Ni…
  •   @lancewmccarthy kind of sad :/