Bug #14850 Updated: Problems with XML and DTD entities
| From: | mfischer@php.net | Date: | Fri, 04 Jan 2002 18:50:19 +0000 |
| Subject: | Bug #14850 Updated: Problems with XML and DTD entities | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-75891@lists.php.net to get a copy of this message | ||
ID: 14850
Updated by: mfischer
Reported By: mark@chesneycorp.com
Old Status: Open
Status: Feedback
Bug Type: DOM XML related
Operating System: FreeBSD 4.5-PRERELEASE
PHP Version: 4.1.1
New Comment:
For the first bug, you should consult tightly the libxml2 documentation.
libxml2 does the conversion on its own and only hell knows why you get
what you get.
It's probably a runtime configuration option of libxml2 which most
likely also isn't implemented in the domxml interface. Or maybe its even
expected. Anyway, best is you take a look at libxml2 directly .
Feedback.
Previous Comments:
------------------------------------------------------------------------
[2002-01-04 13:39:39] mfischer@php.net
About Example 2:
Entity references defined in the document are their own nodes. You
should carefully look at print_r($node);
Next please don't open one report about two things (even if they look
the same).
------------------------------------------------------------------------
[2002-01-04 10:09:37] mark@chesneycorp.com
There are two instances where I am having problems with entities.
test.php and test.xml below exhibit a problem with xml entities.
The output is:
Blah Blah ® Blah Blah
The expected output was:
Blah Blah ® Blah Blah
The second problem exhibited by test2.php and test2.xml has to do with
DTD entities.
The output is:
Blah Blah
The expected output was:
Blah Blah ® Blah Blah
The setup is PHP 4.1.1 with a patch to php_domxml.c from 1.67.2.9 to
1.90 that fixes a problem with PHP crashing with DTD entities.
test.php:
--
<?
$xml = "test.xml";
$doc = xmldocfile($xml);
$context = $doc->xpath_new_context();
$query = "//test";
$nodes = $context->xpath_eval($query);
$node = $nodes->nodeset[0]->children();
$content .= $node[0]->content;
echo htmlentities($content);
?>
test.xml:
--
<?xml version="1.0"?>
<test>Blah Blah ® Blah Blah</test>
test2.php:
--
<?
$xml = "test2.xml";
$doc = xmldocfile($xml);
$context = $doc->xpath_new_context();
$query = "//test";
$nodes = $context->xpath_eval($query);
$node = $nodes->nodeset[0]->children();
$content .= $node[0]->content;
echo htmlentities($content);
?>
test2.xml:
--
<?xml version="1.0"?>
<!DOCTYPE test [
<!ENTITY reg "®">
]>
<test>Blah Blah ® Blah Blah</test>
------------------------------------------------------------------------
Edit this bug report at http://bugs.php.net/?id=14850&edit=1