ID:               32998
 Updated by:       [EMAIL PROTECTED]
 Reported By:      daine dot mamacos at complinet dot com
-Status:           Open
+Status:           Bogus
 Bug Type:         DOM XML related
 Operating System: Linux 2.4.21-4.ELsmp
 PHP Version:      5.0.3
 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.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.

you told it to insert those, so dont do that or grab the textContent of
CData node


Previous Comments:
------------------------------------------------------------------------

[2005-05-10 14:37:07] daine dot mamacos at complinet dot com

Description:
------------
If you create an element on a DOMDocument, and then append a CDATA
section to the node, if formatOutput is enabled, it makes the node put
a return caridge before and after the CDATA section. IE: 
        <key_0>
<![CDATA[BLAHBLAH]]>
        </key_0>

This is problematic, as when you fetch the data from the node, it
carries the return caridges with it. The only way of solving this
currently (that I know of) is to not use formattput on the
DOMDocument.


Reproduce code:
---------------
<?php
   $dom = new DOMDocument("1.0");
   $dom->formatOutput = true;
   $node = $dom->createElement("node");
   $cdata = $dom->createCDATASection("BLAH BLAH BLAH");
   $dom->appendChild($node);
   $node->appendChild($cdata);
   $dom2 = DOMDocument::loadXML($dom->saveXML());
   $rootNode = $dom2->documentElement;
   $text = $rootNode->textContent;
   print("'$text'");
   $packData = @unpack("H*", $text);
   print_r($packData);
?>

Expected result:
----------------
'BLAH BLAH BLAH'Array
(
    [1] => 424c414820424c414820424c4148
)


Actual result:
--------------
'
BLAH BLAH BLAH
'Array
(
    [1] => 0a424c414820424c414820424c41480a
)
//you can see the 0A after the ' and before the closing '


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=32998&edit=1

Reply via email to