private function _fetchFirstTextNode($node) { foreach ($node->childNodes as $child) { if ($child->nodeType === XML_TEXT_NODE) { return $child; } } }