Opening and ending tag mismatch & Premature end of data in tag rss Opening and ending tag mismatch & Premature end of data in tag rss php php

Opening and ending tag mismatch & Premature end of data in tag rss


This is due to the usage of <br> and other self closing tags. The dom tries to find the end like this <br/> where <br is start and /> is end. Modern browsers will not have problems with <tag> but the php dom function still wants you to keep the XML standard so you need to find al the <singletags> and replace them with <singletags /> then it works just fine.


When the fragment you want to parse is not conform to XML specs (eg self closing tags without '/' or unclosed tags) and if it dosesn't contain duplicate ids you can try with loadHTML, it's more permissive.

$xmlDoc->loadHTML($xml);