Re: Re: Validation XHTML code and repairing broken one

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Al wrote:



Hello,

I have few questions about validation XHTML and repairing if it's
broken. The problem is that I have some, for example HTML code (simple
web page) and want to load that page to DOMDocument and than make
something of it. That part works perfect, but if there is unclosed tag
or something like that when I try to load that page I get an error
because now that code is not valid. So my question would be, is there
some way that I could build some script in php that would run thought
that page and check if it's valid or not, and if it's not than try to
repair it. Something that you have in all tools, for example Eclipse,
NetBeans, etc. If anyone have any idea, please help me, because I'm
stuck in here :-(

Regards,
Dusan


I spent some time on this issue because I have several applications where users enter text that must be later displayed as valid XHTML on a webpage.

I've found Tidy [a PHP extension] is the best and simplest solution.

I agree - you can pass it through tidy and then import it into a DOM or whatever it is you need x(ht)ml for.

It works well for me.

You can also use HTML Purifier to remove tags you do not want to allow, and HTML Purifier can pass it through tidy for you.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux