Interesting Toolkits for Working with HTML Documents

Found two very interesting toolkits for working with HTML Documents programmatically.

  • NHaml

    „NHaml (pronounced enamel) is a pure .NET implementation of the popular Rails Haml view engine. From the Haml website:

  • “Haml is a markup language that‘s used to cleanly and simply describe the XHTML of any web document, without the use of inline code. Haml functions as a replacement for inline page templating systems such as PHP, ERB, and ASP. However, Haml avoids the need for explicitly coding XHTML into the template, because it is actually an abstract description of the XHTML, with some code to generate dynamic content.”

    With Code like this you can create a XHTML Document; you don’t need to make open/closing tags -> NHaml does it for you

    %h2= ViewData.CategoryName
      - foreach (var product in ViewData.Products)
          = product.ProductName 

    You can use it in ASP.Net MVC projects but also in standalone projects. To use it there, use this code

    var templateCompiler = new TemplateCompiler();
    var viewType = templateCompiler.Compile("MyTemplate.haml");		
    var view = (ICompiledView)Activator.CreateInstance(viewType);   string output = view.Render();

    A good Tutorial can be found here….

  • HTML Agility Toolkit

    „This is an agile HTML parser that builds a read/write DOM and supports plain XPATH or XSLT (you actually don’t HAVE to understand XPATH nor XSLT to use it, don’t worry…). It is a .NET code library that allows you to parse „out of the web“ HTML files. The parser is very tolerant with „real world“ malformed HTML. The object model is very similar to what proposes System.Xml, but for HTML documents (or streams).

    With this Toolkit you can realise easier HTML Documents in Code than to put it together on yourself…


Kommentar verfassen

Trage deine Daten unten ein oder klicke ein Icon um dich einzuloggen:

Du kommentierst mit Deinem Abmelden /  Ändern )

Google+ Foto

Du kommentierst mit Deinem Google+-Konto. Abmelden /  Ändern )


Du kommentierst mit Deinem Twitter-Konto. Abmelden /  Ändern )


Du kommentierst mit Deinem Facebook-Konto. Abmelden /  Ändern )


Verbinde mit %s