From: xhemjl at tlen dot pl
Operating system: Linux
PHP version: 5.0.2
PHP Bug Type: XML related
Bug description: preserveWhiteSpace and impoted nodes dosn't work
Description:
------------
$doc->preserveWhiteSpace = false;
works fine up to the point when I try to load external XML file.
why is it so important?
firstChild, previousSibling are DOMText so I have to use
getElementsByTagName() which is much slower...
especially when I know that the node I'm interested in
is firstChild (XSD schema)
the $pFileName points to XML file eg.
<Programmers>
<Programmer>
<firstName>Łukasz</firstName>
<lastName>Budnik</lastName>
</Programmer>
</Programmers>
my DOM:
DOM/XML enabled
DOM/XML API Version 20031129
libxml Version 2.6.6
HTML Support enabled
XPath Support enabled
XPointer Support enabled
Schema Support enabled
RelaxNG Support enabled
Reproduce code:
---------------
// up to this point whitespaces are OK
// $doc->preserveWhiteSpace = false;
// load new DomDocument
$tmpXml = DomDocument::load($pFileName);
// preserve whitespaces
$tmpXml->preserveWhiteSpace = false;
$tmpNode = $tmpXml->documentElement;
$contents->appendChild($doc->importNode($tmpNode, true)));
Expected result:
----------------
<?xml version="1.0" encoding="ISO-8859-2"?>
<xhp><properties><Page>index</Page><Module>main</Module><contents><Programmers><Programmer><firstName>Łukasz</firstName><lastName>Budnik</lastName></Programmer></Programmers></contents></xhp>
Actual result:
--------------
<?xml version="1.0" encoding="ISO-8859-2"?>
<xhp><properties><Page>index</Page><Module>main</Module><contents><Programmers>
<Programmer>
<firstName>Łukasz</firstName>
<lastName>Budnik</lastName>
</Programmer>
</Programmers></contents></xhp>
--
Edit bug report at http://bugs.php.net/?id=32033&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=32033&r=trysnapshot4
Try a CVS snapshot (php5.0):
http://bugs.php.net/fix.php?id=32033&r=trysnapshot50
Try a CVS snapshot (php5.1):
http://bugs.php.net/fix.php?id=32033&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=32033&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=32033&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=32033&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=32033&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=32033&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=32033&r=support
Expected behavior: http://bugs.php.net/fix.php?id=32033&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=32033&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=32033&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=32033&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=32033&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=32033&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=32033&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=32033&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=32033&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=32033&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=32033&r=mysqlcfg