#31200 [NEW]: DOMDocument->xinclude() outputs a part of the DTD
| From: | diodu at keliglia dot com | Date: | Mon, 20 Dec 2004 13:03:21 +0000 |
| Subject: | #31200 [NEW]: DOMDocument->xinclude() outputs a part of the DTD | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-70688@lists.php.net to get a copy of this message | ||
From: diodu at keliglia dot com
Operating system: Linux debian
PHP version: 5.0.3
PHP Bug Type: DOM XML related
Bug description: DOMDocument->xinclude() outputs a part of the DTD
Description:
------------
When trying to xinclude an XML file with an attached DTD,
DOMDocument->xinclude() outputs a part of the DTD in the result. Deleting
the Doctype line in the included file fix the problem.
Reproduce code:
---------------
<?php
// book.xml being the XML file described here:
http://livedocs.phpdoc.info/index.php?l=en&q=ref.dom#dom.examples
$xml =<<<EOD
<?xml version="1.0" ?>
<chapter xmlns:xi="http://www.w3.org/2001/XInclude">
<title>Books of the other guy..</title>
<para>
<xi:include
href="book.xml#xpointer(/book/chapter/para/informaltable/tgroup/tbody/*)"
parse="xml">
<xi:fallback>
<error>xinclude: book.xml not found</error>
</xi:fallback>
</xi:include>
</para>
</chapter>
EOD;
$dom = new DOMDocument;
$dom->loadXML($xml);
$dom->xinclude();
echo $dom->saveXML();
?>
Expected result:
----------------
<?xml version="1.0"?>
<chapter xmlns:xi="http://www.w3.org/2001/XInclude">
<title>Books of the other guy..</title>
<para>
<row xml:base="/home/didou/book.xml">
<entry>The Grapes of Wrath</entry>
<entry>John Steinbeck</entry>
<entry>en</entry>
<entry>0140186409</entry>
</row><row xml:base="/home/didou/book.xml">
<entry>The Pearl</entry>
<entry>John Steinbeck</entry>
<entry>en</entry>
<entry>014017737X</entry>
</row><row xml:base="/home/didou/book.xml">
<entry>Samarcande</entry>
<entry>Amine Maalouf</entry>
<entry>fr</entry>
<entry>2253051209</entry>
</row>
</para>
</chapter>
Actual result:
--------------
<?xml version="1.0"?>
<!DOCTYPE chapter [
<!ENTITY uArr "â">
<!ENTITY hcirc "Ä¥">
<!ENTITY icirc "î">
<!ENTITY equals "=">
<!ENTITY cong "â
">
<!ENTITY icy "Ð">
// a hundred of similar lines
<!ENTITY sstarf "â">
<!ENTITY samalg "âThe Grapes of Wrath</entry>
<entry>John Steinbeck</entry>
<entry>en</entry>
<entry>0140186409</entry>
</row><row xml:base="/home/didou/book.xml">
<entry>The Pearl</entry>
<entry>John Steinbeck</entry>
<entry>en</entry>
<entry>014017737X</entry>
</row><row xml:base="/home/didou/book.xml">
<entry>Samarcande</entry>
<entry>Amine Maalouf</entry>
<entry>fr</entry>
<entry>2253051209</entry>
</row>
</para>
</chapter>
--
Edit bug report at http://bugs.php.net/?id=31200&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=31200&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=31200&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=31200&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=31200&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=31200&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=31200&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=31200&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=31200&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=31200&r=support
Expected behavior: http://bugs.php.net/fix.php?id=31200&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=31200&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=31200&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=31200&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=31200&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=31200&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=31200&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=31200&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=31200&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=31200&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=31200&r=mysqlcfg