All,
I am trying to load an XML file into DOM, but it fails due to the following reason:
- Presence of the registered trademark
®
(R with Circle) in the file.
Basically, if it shows the trademark sign (R with a Circle) then DOM fails to load the file.
The Error that is displayed are:
encoder errorCData section not finished
Premature end of data in tag elm line 12
When I check encoding of the file I get ASCII. If I physically remove that Character from the file, then everything works just fine.
I am loading the file using the following code:
$xml_dom = new DOMDocument();
$xml_dom->preserveWhiteSpace = false;
$result = $xml_dom->load($file);
$result = ''
(empty) when it fails. But when I remove the trademark character and everything works, $result = 1
Is there a way to ask DOM to ignore that character? Is that character supposed to show if encoding is ASCII?. This file is not generated by me, so changing encoding at this point is not an option.... Thank you!