News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Greg Szorc's Blog:
Using DTD's and Catalogs for XHTML Validation
April 10, 2008 @ 11:29:48

Greg Szorc shows how, in this entry on his blog, to use DTDs and catalogs to validate your XHTML pages with a little help from PHP.

This [validation from an external site like the W3C validator] approach is a good start, but it is far from ideal because it is based on an honor system of sorts. You often forget to validate each change you make and there is always some corner case that you forget. So, what can be done about it? Well, if you find yourself developing in PHP, you can employ the following solution.

The code he includes pulls in the XHTML content from your page (or the output of the framework's view layer) and pushes it into a DOMDocument that's build with the LIBXML_DTDLOAD and LIBXML_DTDATTR options.

0 comments voice your opinion now!
html validation dom extension document import


blog comments powered by Disqus

Similar Posts

SitePoint PHP Blog: How to Install PHP on Windows

Philip Norton's Blog: Creating A Thumbnail Of A Word Document With PHP And LiveDocx

James Morris' Blog: Parsing HTML with DOMDocument and DOMXPath::Query

Ulrich Kautz: C-based Web Frameworks for PHP

PHPClasses.org: Lately in PHP, Episode 26 - Accelerating PHP 5.4 with updated PHP cache extensions


Community Events

Don't see your event here?
Let us know!


project php7 symfony series programming composer example list language community api laravel introduction part2 framework podcast interview opinion yii2 application

All content copyright, 2015 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework