Isn't there a module called HTML-Tidy (or something similar) which can clean up ill-formed HTML?
If I remember well, it could unmix mixed-up HTML-tags. Perhaps it can give you some pointers how to do it.
CountZero
"If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law
In reply to Re: Fixing ill-formed XML
by CountZero
in thread Fixing ill-formed XML
by mush4brains
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |