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 :-(


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 know about JAVA based, client-side scripts; but, don't like having to be constantly updating them for bug fixes, security patches and IE changes, etc.]

However, my applications are designed to run on shared hosts and many web hosts won't install it for them. So, I've had to script my own XHTML validator. You are welcome to use the functions, just ask. I must warn you, much of the code uses regex expressions; so, if you are not familiar with regex, I'd advise not using them.


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

Reply via email to