#32033 [Opn->Bgs]: preserveWhiteSpace and impoted nodes dosn't work
| From: | rrichards@php.net | Date: | Sun, 20 Feb 2005 13:20:15 +0000 |
| Subject: | #32033 [Opn->Bgs]: preserveWhiteSpace and impoted nodes dosn't work | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-74312@lists.php.net to get a copy of this message | ||
ID: 32033
Updated by: rrichards@php.net
Reported By: xhemjl at tlen dot pl
-Status: Open
+Status: Bogus
Bug Type: XML related
Operating System: Linux
PHP Version: 5.0.2
New Comment:
Sorry, but your problem does not imply a bug in PHP itself. For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system
is not the
appropriate forum for asking support questions.
Thank you for your interest in PHP.
Previous Comments:
------------------------------------------------------------------------
[2005-02-20 10:59:04] xhemjl at tlen dot pl
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 this bug report at http://bugs.php.net/?id=32033&edit=1