#27541 [Opn->Bgs]: SimpleXML fails to load an xml file which contains html entities
| From: | iliaa@php.net | Date: | Tue, 09 Mar 2004 23:25:54 +0000 |
| Subject: | #27541 [Opn->Bgs]: SimpleXML fails to load an xml file which contains html entities | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-56195@lists.php.net to get a copy of this message | ||
ID: 27541
Updated by: iliaa@php.net
Reported By: silver_dragoon77 at hotmail dot com
-Status: Open
+Status: Bogus
Bug Type: SimpleXML related
Operating System: WinXP
PHP Version: 5.0.0b4 (beta4)
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
XML parsers cannot understand html entities, you must use
&#[number]; to represent 'special' characters.
Previous Comments:
------------------------------------------------------------------------
[2004-03-09 13:25:30] silver_dragoon77 at hotmail dot com
Ooops sorry I didn't realize that my file wasn't unicode encoded !
------------------------------------------------------------------------
[2004-03-09 13:00:49] silver_dragoon77 at hotmail dot com
Description:
------------
The example string given at the php simple xml manual page contains
actór (spanish stress on the "o"). simplexml_load_string or even
simplexml_load_file both fail. If I remove the ó it works fine.
Reproduce code:
---------------
$xmlstr = <<<XML
<?xml version='1.0' standalone='yes'?>
<movies>
<movie>
<title>PHP: Behind the Parser</title>
<characters>
<character>
<name>Ms. Coder</name>
<actor>Onlivia Actora</actor>
</character>
<character>
<name>Mr. Coder</name>
<actor>El Actor</actor>
</character>
</characters>
<plot>
So, this language. It's like, a programming language. Or is it a
scripting language? All is revealed in this thrilling horror spoof
of a documentary.
</plot>
<rating type="thumbs">7</rating>
<rating type="stars">5</rating>
</movie>
</movies>
XML;
$xml = simplexml_load_string($xmlstr);
var_dump($xml);
Expected result:
----------------
var_dump should return a simplexml object
Actual result:
--------------
$xml is bool(false)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=27541&edit=1