472,951 Members | 1,879 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,951 software developers and data experts.



Does anybody here have any example code for Tidy.Net
(http://sourceforge.net/projects/tidynet/) ?

I can't find one single example. I try to convert a html-string to well
formed xhtml, but the only output I get is /r/n

Any help would be appreciated :)

Best Regards

Dec 13 '06 #1
1 20106
It wasn't actually that hard to figure it out ;) I just forgot to reset
the position of the stream, therefor the "/r/n"-result ;) Here is a
code example if anyone else needs one in the future:

Tidy tidy = new Tidy();

/* Set the options you want */
tidy.Options.DocType = DocType.Strict;
tidy.Options.DropFontTags = true;
tidy.Options.LogicalEmphasis = true;
tidy.Options.Xhtml = true;
tidy.Options.XmlOut = true;
tidy.Options.MakeClean = true;
tidy.Options.TidyMark = false;

/* Declare the parameters that is needed */
TidyMessageCollection tmc = new TidyMessageCollection();
MemoryStream input = new MemoryStream();
MemoryStream output = new MemoryStream();

byte[] byteArray = Encoding.UTF8.GetBytes("Put your HTML here...");
input.Write(byteArray, 0 , byteArray.Length);
input.Position = 0;
tidy.Parse(input, output, tmc);

string result = Encoding.UTF8.GetString(output.ToArray());

Dec 17 '06 #2

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

Similar topics

by: compu_global_hyper_mega_net_2 | last post by:
Greetings, usenet's obviously dying. Where's everyone hanging out? One of the yahoo groups or something? anyway. Hopefully someone picks this up: I'm trying to compile php-5.0.0RC2 with...
by: Mike Gifford | last post by:
Hello Folks, I'm trying to get tidy set up on a pretty standard fedora core 1 server. Looks pretty simple from here: http://ca3.php.net/manual/en/ref.tidy.php Should just have to go: pear -v...
by: Börni | last post by:
Hello, I am using tidy to clean up an xml file, but my problem is that it replaces newlines with normal whitespaces. Still worse is that if i retrieve text from the xml file it contains all...
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...
by: Stefan Weiss | last post by:
Hi. (this is somewhat similar to yesterday's thread about empty links) I noticed that Tidy issues warnings whenever it encounters empty tags, and strips those tags if cleanup was requested....
by: Christoph Schneegans | last post by:
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...
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...
by: BG Mahesh | last post by:
hi I have installed Tidy on Fedore Core 4.0 using RPM. I have a very simple script that uses tidy, ------------tidy.php------------------ <html>a html document</html> <? $html =...
by: kempshall | last post by:
Can somebody please tell me how to install the Tidy module for PHP 5 on a Mac? I tried what the php.net website said, which is running the command "pecl install tidy" but the installation failed...
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
by: Mushico | last post by:
How to calculate date of retirement from date of birth
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...

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.