Reputation: 9552
Recently I get an exception while I try to implement a special template engine.
Mine problem with DOMDocument load is in fact that I use some place holders in href and it will be replaced after with real values. I want to store that template and to use it each time when I need it, here is 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 was try to find a some way to skip that check but couldn't find anything.
Upvotes: 1
Views: 2878
Reputation: 9552
I found what was the problem. In my URL it was &
sign, I was replace it with &
and now it works.
Upvotes: 3
Reputation: 324
This causes no error in PHP 5.3. You must have some other HTML that is causing this. Normally you see this when you use an entity with no ; after it.
<a href="#">Foo   Bar</a>
That throws that same error for me. Look for some entity without a ; on it. Browsers will render that, but it is not correct.
Upvotes: 3