Preferred Member
joined:Dec 10, 2007
posts: 507
votes: 0
Hey all,
I have some problems with HTML entities in XML.
The XML file I have doesn't like having £ or & signs in it, or the HTML entity equivalent.
I have this to read the XML file:
$file = "stuff.xml";
// load file
$xml = simplexml_load_file($file) or die ("Unable to load XML file!");
Whenever I have a single £ or & sign in, it throws the unable to load file error. Remove the signs out completely and it displays the XML content fine.
I would of thought that simply using some PHP to convert the characters would be sufficient, but as it fails in loading the XML to begin with, this can't be done. Other than manually changing all the £ and & to XML friendly entities (but I dont know of one for either sign), is there any other solution?
Thanks.