コード例 #1
0
ファイル: ezxmltexttype.php プロジェクト: nlescure/ezpublish
 /**
  * Recursively drills down in the xml tree in $node and
  * concatenates text content from the DOMNodes with a space
  * in-between to make sure search words from two different lines
  * are merged.
  *
  * @param DOMNode $node
  * @return string
  */
 static function concatTextContent($node)
 {
     $retString = '';
     if (!$node instanceof DOMNode) {
         return $retString;
     }
     if ($node->hasChildNodes()) {
         $childArray = $node->childNodes;
         foreach ($childArray as $child) {
             $retString .= eZXMLTextType::concatTextContent($child);
         }
     } elseif ($node->nodeType === XML_TEXT_NODE) {
         return $node->textContent . ' ';
     }
     return $retString;
 }