php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #31306 textContent retrieves ALL cdata in children as well
Submitted: 2004-12-27 02:46 UTC Modified: 2004-12-27 12:28 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: js at enradia dot com Assigned:
Status: Not a bug Package: DOM XML related
PHP Version: 5.0.3 OS: gentoo linux
Private report: No CVE-ID: None
 [2004-12-27 02:46 UTC] js at enradia dot com
Description:
------------
using the method textContent on a node using teh php 5 DOM 
retrieves the cdata for every child as well - that doesn't 
seem right. it certainly is useless 

Reproduce code:
---------------
XML
--------------
<?xml version="1.0"  ?> 
<base> 
I see
    <item>   
       stuff 
    </item> 
    <item>   
       and
    </item> 
   <item>   
       more 
      <subitem>stuff</subitem>
    </item> 
    
</base> 

PHP
-----------
$root = $this->registry->getElementsByTagName('base');
       
        foreach($root as $node) { 
            print $node->textContent . " "; 
        } 

Expected result:
----------------
I see 

Actual result:
--------------
I see stuff and more stuff 

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-12-27 12:28 UTC] rrichards@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

Behavior is per the DOM specs: http://www.w3.org/TR/DOM-Level-3-Core/core.html#Node3-textContent
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Apr 24 23:01:34 2024 UTC