HTML Tidy in ASP.NET

Discussion in 'ASP .Net' started by Christoph Schneegans, Nov 2, 2003.

  1. Hi!

    I'd like to present an easy, yet powerful approach to use the HTML
    Tidy program from <http://tidy.sourceforge.net/> in ASP.NET. It is
    similiar to
    <http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dv_vstechart/html/tchVSAddinEnablingHTMLTidy.asp>.
    However, it is not implemented as a Visual Studio Add-in, but as a
    response filter. This way, the complete HTML source is tidied,
    including the output of web controls.

    The VB.NET code can be downloaded from
    <http://schneegans.de/temp/TidyFilter.vb.txt>. Furthermore, you need
    the executable tidy.exe, which can be downloaded from
    <http://tidy.int64.org/tidy-exe.zip>, and a configuration file
    tidy.cfg. You should see reasonable results with
    <http://schneegans.de/temp/tidy.cfg.txt>. Place both tidy.exe and
    tidy.cfg in the root directory of your web application.

    You call the filter by adding

    Response.Filter = New TidyFilter(Response.Filter)

    to your .aspx file(s). Page_Load seems to be the proper place to do
    this.

    Since Tidy is able to convert HTML to XHTML, you can use Tidy's output
    to create an XmlDocument, by calling another filter:

    Response.Filter = New TidyFilter(New XhtmlFilter(Response.Filter))

    The XhtmlFilter class could apply an XSLT stylesheet to your page, add
    arbitrary elements or attributes, or just change the attribute value
    delimiter from " to '.

    Feedback is greatly appreciated.

    --
    <http://schneegans.de/> · MVP FrontPage · <script></script> |
     
    Christoph Schneegans, Nov 2, 2003
    #1
    1. Advertising

  2. Christoph Schneegans

    GeorgePalframan

    Joined:
    Jul 23, 2008
    Messages:
    1
    English Version Request.

    Hi Cristoph,
    I would really like to use your Tidy Filter in ASP.NET
    The problem I have is that I do not understand Deutschen Sprach at all well enough to understand what is "going on" on the page. Could you provide me with an english alternative please?

    Many thanks,
    George Palframan.
     
    GeorgePalframan, Jul 23, 2008
    #2
    1. Advertising

  3. Christoph Schneegans

    mthakershi

    Joined:
    Aug 8, 2006
    Messages:
    2
    Hello, I am trying to use this tidy library to remove spaces from my ASPX page output.

    However, I am getting two errors.
    - Invalid use of response filter.
    - And I am having to assign execute permission.

    Is this because my output is GZip compressed?

    Please help.

    Malay Thakershi
     
    mthakershi, Apr 28, 2009
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. d davis
    Replies:
    0
    Views:
    488
    d davis
    Apr 27, 2004
  2. Eric
    Replies:
    0
    Views:
    539
  3. Tobias Wendorff

    HTML Tidy

    Tobias Wendorff, Apr 27, 2005, in forum: C++
    Replies:
    26
    Views:
    2,392
    Phlip
    Apr 28, 2005
  4. =?utf-8?q?Bj=C3=B6rn_Lindstr=C3=B6m?=

    ElementTree Tidy HTML Tree Builder and comments

    =?utf-8?q?Bj=C3=B6rn_Lindstr=C3=B6m?=, Mar 19, 2005, in forum: Python
    Replies:
    0
    Views:
    373
    =?utf-8?q?Bj=C3=B6rn_Lindstr=C3=B6m?=
    Mar 19, 2005
  5. Jon Davis

    Managed HTML Tidy?

    Jon Davis, Nov 21, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    472
    Jon Davis
    Nov 21, 2006
Loading...

Share This Page