tidy

Use HTML Tidy executable with php, instead of compling

I have an application in php that is intended for shared hosting. So, I am going to have a hard time always getting html tidy compiled, since the hosts will vary, and what they provide will vary. Is it possible to just include the tidy executable in with my php application, and somehow, pipe html through that for cleaning? I am just l...

tidy_parse_string expects exactly 1 parameter, 2 given

I have HTML tidy extension on my home computer using PHP 5.2.11 (Windows - WAMP), and I use this to clean up HTML: $data = tidy_parse_string($data, array( 'clean' => TRUE, 'indent' => 0, 'output-xhtml' => true, 'wrap' => 7000, )); This works great on my home machine, but on the actual server on which the website run...

jQuery/Javascript: tidy html

hi all, i'm got a little html-wysiwyg editor in my cms and was wondering - is there a good script for tidying up html client-side? i'm mainly struggling with html that's pasted from winword. maybe some regex would help already. thanks in advance ...

PHP Tidy Module: unsupported node type?

When using the PHP Tidy Library (More Specifically, The tidy_repair_string function) I keep getting the following error: Unsupported node type:8. what does this error mean, and what can I do to get around this? ...

Tidiest way to filter out rows where all columns = a value

I have a query with loads of columns. I want to select rows where not all the columns are equal to 0. select * from table where not ( column1 = 0 and column2 = 0 and column3 = 0 and ... column45 = 0) Is this really the tidiest way to do it? Supposing I then need to change it to ignore when all columns are 1, or negative.. It...

How can I get the error/warning messages out of the parsed HTML using JTidy?

I am able to parse the HTML but I want to extract the warning messages from the parsed HTML and show them to the user. Here is my code: Tidy tidy = new Tidy(); StringBuffer StringBuffer1 = new StringBuffer("<b>Hello<u><b>I am tsting another one.....<i>another....."); InputStream in = new ByteArrayInputStream(StringBuffer1.toString().g...

How do I get HTML Tidy to not put newline before closing tags?

HTML Tidy has this infuriating habit of putting a newline before the closing tag. For example: <p>Some text</p> becomes <p>Some text </p> How do I tell Tidy to keep the closing tag on the same line as the end of the content? Btw, I am running Tidy through Notepad++, if that makes any difference. ...

Automatically tidy up JSP/JSF files

Hi, I am working on a webapplication and I do most of the XHTML stuff in an editor. Every once in a while I froget to close a tag or mess up the nesting (we all get distracted sometimes ;-)). So I commpile, package and run my webapp (using maven mvn clean package jetty:run-war only to notice that displaying the view (where I messed up ...

Proper usage of JTidy to purify HTML

Hello, I am trying to use JTidy (jtidy-r938.jar) to sanitize an input HTML string, but I seem to have problems getting the default settings right. Often strings such as "hello world" end up as "helloworld" after tidying. I wanted to show what I'm doing here, and any pointers would be really appreciated: Assume that rawHtml is the Strin...

strip extra quotes from html using uTidy

Hi, Could anyone tell me how I could remove extra-quotes from my HTML using uTidy. The malformed HTML tag looks like this: <th align="left""> <input type="submit" style="font-weight: bold;" value="Go"> </th> I would also like to remove some empty attributes in the HTML that looks like this (notice the alt tag): <img src="http://sta...

extract part of html using tidy in php

hi, I want to extract particular part of HTML using tidy in php. the html page has table in it and i just want to fetch that table from html page. please help and post the solution.... Thanks ...

Git - tidying up a repo

Hi I have got my repo into a bit of a state and want to be able to work my way out of it The repo looks a bit like this (A1, B1, C1 etc are obviously commits) A1 ---- A2 ---- A3 ---- A4 ---- A5 ---- A6 ---- A7 ---- A8 / (from a remote repo) B1 ---- B2...

Encoding problem wirh JDBC and MySQL

I'm grabbing data from RSS-channels, sanitize it and save in the database. I use java, tidy, MySQL and JDBC. Steps: I grab RSS-records. It's OK. I sanitize html with tidy. Here is one transformation. Tidy automatically converts strings like "So it&#8217;s unlikely" to "So it’s unlikely". I save this string to the table MySQL scheme ...

Tidy breaks links with not-latin chars

I use java library Tidy to sanitize html-code. Some of the code contains links with Russian letters. For example <a href="http://example.com/Русский"&gt;link with Russian letters</a> I understand that "Русский" must be escaped, but I get this html from users. And my job is to convert it to XHTML. I think tidy tries to escape not-lati...

PHP Extension using libtidy compiles, but does not load

I wrote an extension in C++ that uses libtidy, and it runs perfectly under PHP when I compile PHP --with-tidy. However, it would be nice to have the extension run on a vanilla PHP. When I try to use the extension, I get something like: PHP Warning: PHP Startup: Unable to load dynamic library 'extension.so': undefined ...

How to clean up my code

Being new to this I really am trying to learn how to keep code as simple as possible, whilst doing the job it's supposed to. The question I have done is from Project Euler, it says Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be: ...

Php Tidy : remove link and style tags inside body

Hello, I must cleanup some HTML code to remove <style> and <link> tags inside the <body> tag. I'm already using PHP Tidy to do some cleanup but I did not found how to remove those tags with PHP Tidy. Do you have a solution ? Or maybe another markup cleaner PHP class... ...

XSS Prevention, Tidy vs Purifier?

Greetings, I'm trying to prevent XSS and improper html from input fields using CKEditor (a javascript WYSIWYG editor). How should I filter this data on the server side? The two options I'm comparing are PHP Tidy and HTML Purifier. I'm interested in speed, security, and valid nesting. Edit: According to HTML Purifier, Tidy does not...

configure tidy to escape the unknown xml tags

Hi, I am using tidy to make HTML entered by the user well-formed and i have configured tidy to accept only few html tags. Is there a way i can tell tidy to escape sequence the xml tags that are not known. Example input and the expected output are given below- Input:: <div> <p>this is a paragraph</p> <unknown-tag>text in unkn...

Install Tidy, PHP.

I guess when php was installed on my box --with-tidy arg was not included. When browsing my php.ini the line: ;extension=php_tidy.dll is missing. How can I add the module to my php install? Note I tried adding: extension=php_tidy.dll but with no luck. I checked the docs but all they say is: This extension is bundled with PHP...