I'm trying to use PHP with SimpleXML to parse an XHTML file, however the file contains < and > signs which are not part of the markup and cause parsing to fail (opening and end tag mismatches).
How can I convert these to HTML entities before parsing without changing the file or affecting the markup?
Example:
<p> a < b </p>
Would become:
<p> a < <b> </p>