You are here: Re: [PHP] DOMDocument and html doctype « PHP « IT news, forums, messages
Re: [PHP] DOMDocument and html doctype

Posted by Brian V Bonini on 05/15/05 01:12

On Sat, 2005-05-14 at 16:08, Johannes Findeisen wrote:
> 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.

I'm sorry, I missed your solution, what was it again?

He said "Do someone know how I can access this string?" There it is,
"THAT" string is now in $matches[0]; Do what you want with it from
there. Otherwise set pattern to a regex and search for similar strings
if the search pattern is not EXACTLY that.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация