From:             Laurent dot Lyaudet at gmail dot com
Operating system: Debian Linux
PHP version:      5.4.19
Package:          DOM XML related
Bug Type:         Bug
Bug description:ChildNodes of DOMNodes list great childs, etc. as DOMText

Description:
------------
Hi,

When using DOMNodes and other heriting classes (DOMDocument, DOMElement,
etc.),
the childNodes attribute lists real childrens as DOMElement mixed with
DOMText for the content of grandchildren.

It is similar to bug 40175 but more detailed. Moreover I don't see why the
manual is cited as a justification for bug 40175:
from http://www.php.net/manual/en/class.domnode.php :
> childNodes
>
>    A DOMNodeList that contains all children of this node. If there are no
>children, this is an empty DOMNodeList.


I join a debug function to supplement the bug in var_dump (see bug 65565 :
https://bugs.php.net/bug.php?id=65565&thanks=4).

function debugSousBalises($p_oBalise){

  for($i = 0; $i < $p_oBalise->childNodes->length; ++$i){
    $oNode = $p_oBalise->childNodes->item($i);
    //var_dump($oNode);
    switch(get_class($oNode)){
      case 'DOMText':
        echo $oNode->wholeText;
        break;
      case 'DOMElement':
        echo $oNode->tagName.' : '.$oNode->nodeValue;
        break;
      default:
          echo get_class($oNode).' pas encore pris en compte';
    }
  }

}

used on the following fragment of xml 
<balise>
  <ata>2013-08-20T17:13:25</ata>
  <atd>2013-08-20T17:15:03</atd>
  <callSequence>1</callSequence>
  <actualCallSequence>2</actualCallSequence>
  <clauseInfo>
    <clause>LIV_CFM</clause>
    <description>Conforme</description>
  </clauseInfo>
</balise>

it will yield:
  ata : 2013-08-20T17:13:25
  atd : 2013-08-20T17:15:03
  callSequence : 1
  actualCallSequence : 2
  clauseInfo :
    LIV_CFM
    Conforme

Best regards,
   Laurent Lyaudet



-- 
Edit bug report at https://bugs.php.net/bug.php?id=65569&edit=1
-- 
Try a snapshot (PHP 5.4):   
https://bugs.php.net/fix.php?id=65569&r=trysnapshot54
Try a snapshot (PHP 5.3):   
https://bugs.php.net/fix.php?id=65569&r=trysnapshot53
Try a snapshot (trunk):     
https://bugs.php.net/fix.php?id=65569&r=trysnapshottrunk
Fixed in SVN:               https://bugs.php.net/fix.php?id=65569&r=fixed
Fixed in release:           https://bugs.php.net/fix.php?id=65569&r=alreadyfixed
Need backtrace:             https://bugs.php.net/fix.php?id=65569&r=needtrace
Need Reproduce Script:      https://bugs.php.net/fix.php?id=65569&r=needscript
Try newer version:          https://bugs.php.net/fix.php?id=65569&r=oldversion
Not developer issue:        https://bugs.php.net/fix.php?id=65569&r=support
Expected behavior:          https://bugs.php.net/fix.php?id=65569&r=notwrong
Not enough info:            
https://bugs.php.net/fix.php?id=65569&r=notenoughinfo
Submitted twice:            
https://bugs.php.net/fix.php?id=65569&r=submittedtwice
register_globals:           https://bugs.php.net/fix.php?id=65569&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=65569&r=php4
Daylight Savings:           https://bugs.php.net/fix.php?id=65569&r=dst
IIS Stability:              https://bugs.php.net/fix.php?id=65569&r=isapi
Install GNU Sed:            https://bugs.php.net/fix.php?id=65569&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=65569&r=float
No Zend Extensions:         https://bugs.php.net/fix.php?id=65569&r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=65569&r=mysqlcfg

Reply via email to