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!

  •   having a fun afternoon with #fluent and #rome ; let see if can make something publishable
  •   RT @pag3rd: If you'll be at #MSIgnite and want to learn about what's new with #XAML #FluentDesign and the brand new #WinUI library come to…
  •   RT @kevintgallo: What’s your favorite color? https://t.co/GvhJIb4ItX
  •   @shanselman @tomasrestrepo @h0x0d @joncaves does it mean @satyanadella holds the mic for you next time at build?
  •   @BNR De eindstand (aangekomen op bestemming) https://t.co/DXxHPP57iy
  •   Toch even aan die conditie werken.. Je weet maar nooit @bnr #fiemibo https://t.co/H61vOPrtVi
  •   RT @donasarkar: Hello #WindowsInsiders we have released 19H1 Build 18242 to Skip Ahead! https://t.co/kuo5Y9jt0i
  •   @BNR Zines de 2 jaar dat ik bij bnr heb gewerkt 😊 #ikhoorbijbnr
  •   @JenMsft is there a way to get notfication mirring from android to win desktop without the cortana app (its not available in netherlands)
  •   @tomverhoeff @bartlannoeye i agree with bart in this.. been seeing enough 'good speakers' just delivering 101 sessions all the time