473,804 Members | 2,154 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Tidy.Net

Hello,

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
Martin

Dec 13 '06 #1
1 20221
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.Do cType = DocType.Strict;
tidy.Options.Dr opFontTags = true;
tidy.Options.Lo gicalEmphasis = true;
tidy.Options.Xh tml = true;
tidy.Options.Xm lOut = true;
tidy.Options.Ma keClean = true;
tidy.Options.Ti dyMark = false;

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

byte[] byteArray = Encoding.UTF8.G etBytes("Put your HTML here...");
input.Write(byt eArray, 0 , byteArray.Lengt h);
input.Position = 0;
tidy.Parse(inpu t, output, tmc);

string result = Encoding.UTF8.G etString(output .ToArray());

Dec 17 '06 #2

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

Similar topics

0
1802
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 tidy support. ../configure --with-mysql=/usr/local/mysql --with-apxs2=/usr/local/apache2/bin/apxs
1
2152
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 install tidy However, it won't work unless you have the following up and running on
0
3328
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 whitespaces tidy inserted to nicely render the file. The xml files are generated and retrieved with an DomDocument. preserveWhitespace is false. At the time i am solving the problem with some regexps and string
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>
12
17119
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. This is okay in some cases (such as <tbody>), but problematic for other tags (such as <option>). Some tags (td, th, ...) do not produce warnings when they are empty.
0
1855
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 <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.
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>
0
1886
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 = ob_get_clean(); // Specify configuration
0
5039
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 somewhere in the make script. (It looks like PECL is trying to install Tidy version 1.2, even though the documentation says that's only for PHP4.) Any help would be greatly appreciated. Here's the output from the "pecl install tidy" command in...
0
9594
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10343
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
10341
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,...
0
9171
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5530
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5673
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4308
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
3831
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3001
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.