Re: DOMDocument and html doctype

From: Date: Sat, 14 May 2005 20:08:58 +0000
Subject: Re: DOMDocument and html doctype
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-215237@lists.php.net to get a copy of this message
On Saturday 14 May 2005 16:25, Brian V Bonini wrote: > <?php > > $html = <<<EOS > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> > <html><body>Test<br></body></html> > EOS;   > > $pattern = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 > Transitional//EN">'; > > $doc = new DOMDocument(); > $doc->loadHTML($html); > preg_match($pattern, $doc->saveHTML(), $matches); > echo '&lt;' . $matches[0] . '&gt;'; > > ?> Well, that ist a very crazy idea... If Claudio knows the doctype allready, he not needs to access this doc type string. A preg_match is the wrong function at this place or will you write a switch/case block that knows every doctype definition? This only is usefull to see if the string exists or not. Regards -- Johannes Findeisen

« previous php.general (#215237) next »