PHP: DOMDocument loadHTML returns error with nesty URL in href -


recently exception while try implement special template engine.

mine problem domdocument load in fact use place holders in href , replaced after real values. want store template , use each time when need it, here code sample

    $this->dom = new domdocument;     $load_html = $this->dom->loadhtml($html); 

and nesty part of html looks like

<a href="@_@web_site_address@_@">visit our web site</a> 

and exception is

fatal error: domdocument::loadxml() [<a href='domdocument.loadxml'>domdocument.loadxml</a>]: entityref: expecting ';' in entity 

i try find way skip check couldn't find anything.

this causes no error in php 5.3. must have other html causing this. see when use entity no ; after it.

<a href="#">foo &nbsp bar</a> 

that throws same error me. entity without ; on it. browsers render that, not correct.


Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -