Msg#: 4465578 posted 7:07 pm on Jun 14, 2012 (gmt 0)
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?
Msg#: 4465578 posted 11:38 am on Dec 18, 2012 (gmt 0)
I was using the XHTML doctype is because the entities in my xml will be identical to xhtml, ie the nodes contain standard markup. As there are rather a lot I didn't want to specify them all, and as the main W3C doctypes come prebuilt into Firefox, the user wouldn't have to download them each time.