HTML safety fix for broken imported HTML content?
Im importing HTML into my page via an XML feed. If the content has an unclosed or unopened div (see below) it completely messes up the page.
<div>Stuff</div> <div>Stuff</div> </div>
<div> <div>Stuff</div> <div>Stuff</div>
I know the best solution is to work on the PHP parsing, which im currently looking at. However as a backup or incase I cant find a PHP solution, is there an HTML fix?
I tried enclosing the entire imported area as a fieldset, ul and li, and span. I hoped this would effectively close any open divs, but none of them worked. Thanks
is there an HTML fix?
No, there isn't. You need to fix the markup before adding it to the document.