hello,
Quelqu'un pourrait me dire pourquoi ceci termine la boucle ?
J'ai exactement la même fonction en php4 qui ne pose aucun problème ...
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2 $subNode->parentNode->removeChild($subNode);
Sans cette ligne ça m'affiche bien tous les noeuds ...
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35 // remove all the outdated child nodes // input nodes // output none function removeOutdated($nodes,$date) {// foreach($nodes as $subNode) {// if($subNode->nodeType==1) {// > if node element if($subNode->getAttribute('dateStartEfficacy')) { $dateStartEff = explode(' ',$subNode->getAttribute('dateStartEfficacy')); //$dateEndEff = explode(' ',$subNode->getAttribute('dateEndEfficacy')); if($dateStartEff[1]>$date) { # !! c'est ici !! echo $subNode->nodeName.' '.$subNode->getAttribute("num").'<hr/>'; //$subNode->parentNode->removeChild($subNode); } } else { // if no date start efficacy > remove node if($this->checkTag($subNode->nodeName)) { $parent=$subNode->parentNode;$parent->removeChild($subNode); } } if($subNode) { //$this->removeOutdated($subNode->childNodes,$date); } }// }// }//








Répondre avec citation




Partager