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!

  •   jeej skype till 22h today..
  •   @VSTS @awscloud @chef @Docker @GooglePlay what are the 10 highest rated widgets?
  •   RT @wpschaub: Over 500 extensions in the VSTS/TFS marketplace https://t.co/pH64ZFRi2J
  •   @mitrik what is difference between code -> files -> history and code -> commits? looks as same? https://t.co/NnA8lk1pTe
  •   @LocalJoost 😵
  •   the moment you need to install ms project....
  •   RT @coolcsh: And we have updated Visual Studio 2017 w/15.3 to for .NET Core 2, https://t.co/2y7Qj07QrB Core 2, .NET Standard 2: https://t.c…
  •   @JenMsft do you know what changed in the latest version of the mail app? the whats new web page is not beeing updated for long time..
  •   new windows sdk! https://t.co/qOlWLICyIB #uwp #uwpdev
  •   @tfsbuck this way doesnt take in consideration it can be set back to "new" because some blocking issues?