Re: Re: Validation XHTML code and repairing broken one
| From: | Michael A. Peters | Date: | Tue, 22 Sep 2009 10:06:33 +0000 |
| Subject: | Re: Re: Validation XHTML code and repairing broken one | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-298255@lists.php.net to get a copy of this message | ||
Al wrote:
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.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, DusanI 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.