473,808 Members | 2,861 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

HTML Tidy in ASP.NET

Hi!

I'd like to present an easy, yet powerful approach to use the HTML
Tidy program from <http://tidy.sourceforg e.net/> in ASP.NET. It is
similiar to
<http://msdn.microsoft. com/library/default.asp?url =/library/en-us/dv_vstechart/html/tchVSAddinEnabl ingHTMLTidy.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.t xt>. 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(Resp onse.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(Res ponse.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> |
Nov 17 '05 #1
0 1855

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
4241
by: Anders Eriksson | last post by:
Hello! I want to extract some info from a some specific HTML pages, Microsofts International Word list (e.g. http://msdn.microsoft.com/library/en-us/dnwue/html/swe_word_list.htm). I want to take all the words, both English and the other language and create a dictionary. so that I can look up About and get Om as the answer. How is the best way to do this?
2
1529
by: John Resler | last post by:
Hi all, First I want to say I am fully aware of the huge scope of the problem of parsing and correcting files of any sort. I have been using the jTidy libraries (Dave Raggett W3C, I believe) to attempt to clean up the html I use and convert it to xhtml if possible. Not to complain about Tidy, it is the only application I'm aware of that does what it does... I am just curious if there are any other applications/libraries that perform the...
3
2780
by: Mike | last post by:
Greetings, I just used Tidy HTML for the first time. The address below contains the files need to check on Tidy's corrections. I would appreciate any feedback on the Tidy report and the necessity and validity of the changes Tidy has made or recommended. The following is obvious to me: line 194 column 98 - Warning: discarding unexpected </font>
13
2739
by: Arie Mijnlieff | last post by:
Hi ! I have an html file (http://www.kpc.nl/home.html) which i send to the w3 validator as well as to a an online HTML tidy script. The w3 validator (validator.w3.org) claims the frameset tag doesnt have a border tag whereas the html tidy script (http://infohound.net/tidy/tidy.pl) claims everything is ok.. Who is right ? I am asking this because i would like to write clean
40
5621
by: VK | last post by:
Hi, After the response on my request from W3C I'm still unclear about Tidy vs. Validator discrepansies. That started with <IFRAME> issue, but there is more as I know. Anyway, this very basic HTML page: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html401/strict.dtd"> <html> <head>
2
2039
by: Sebastian Gohres | last post by:
Hi! First: sorry for my bad english :) If I parse template files, html tidy remove all tags beginning with { for example: before: <select name="country" size="1">
1
3139
by: Carmen Sei | last post by:
I need to parse HTML page and extract data should I use HTML Tidy DLL http://dev.int64.org/tidy.html or it's easier to use library with source code like http://users.rcn.com/creitzel/tidy.html#cplusplus which HTML Tidy C++ version (easiest) should I use for C++ project?
0
1247
by: tobycraftse | last post by:
any example shows how to use HTML Tidy in VC++ project? I need to parse HTML page and extract data should I use HTML Tidy DLL http://dev.int64.org/tidy.html or it's easier to use library with source code like http://users.rcn.com/creitzel/tidy.html#cplusplus
0
569
by: Lars Eighner | last post by:
In our last episode, <004f629c$0$10265$c3e8da3@news.astraweb.com>, the lovely and talented mark4asp broadcast on comp.infosystems.www.authoring.html: I have not done this, not even on TV.
0
9721
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10631
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10374
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10374
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7651
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6880
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5686
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4331
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3859
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.