Re: Validation XHTML code and repairing broken one

From: Date: Tue, 22 Sep 2009 04:30:40 +0000
Subject: Re: Validation XHTML code and repairing broken one
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-298250@lists.php.net to get a copy of this message
Hello, on 09/17/2009 06:33 AM Dušan Novaković said the following: > 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 :-( You may want to try this HTML parser package. It is tolerating to malformed HTML documents. It returns a stream of document elements, such as tags, data, character entities, etc.. that you can pass back to the class and regenerate a well-formed document. It comes even with filter class that validates the document against a DTD and adds missing closed tags and such. http://www.phpclasses.org/secure-html-filter -- Regards, Manuel Lemos Find and post PHP jobs http://www.phpclasses.org/jobs/ PHP Classes - Free ready to use OOP components written in PHP http://www.phpclasses.org/

« previous php.general (#298250) next »