protected function scanElementForText(\DOMNode $element)
    {
        $str = '';
        foreach ($element->childNodes as $child) {
            /** @var \DOMNode $child */
            if ($child->nodeType == XML_TEXT_NODE) {
                $str .= $child->nodeValue;
            } elseif ($child->nodeType == XML_ELEMENT_NODE && $child->nodeName == 'text:s') {
                // It's a space

                // Multiple spaces?
                /** @var \DOMAttr $cAttr */
                $cAttr = $child->attributes->getNamedItem('c');
                if ($cAttr) {
                    $multiplier = (int) $cAttr->nodeValue;
                } else {
                    $multiplier = 1;
                }

                $str .= str_repeat(' ', $multiplier);
            }

            if ($child->hasChildNodes()) {
                $str .= $this->scanElementForText($child);
            }
        }

        return $str;
    }
protected function scanElementForText(\DOMNode $element)
    {
        $str = '';
        foreach ($element->childNodes as $child) {
            /** @var \DOMNode $child */
            if ($child->nodeType == XML_TEXT_NODE) {
                $str .= $child->nodeValue;
            } elseif ($child->nodeType == XML_ELEMENT_NODE && $child->nodeName == 'text:s') {
                // It's a space

                // Multiple spaces?
                /** @var \DOMAttr $cAttr */
                $cAttr = $child->attributes->getNamedItem('c');
                if ($cAttr) {
                    $multiplier = (int) $cAttr->nodeValue;
                } else {
                    $multiplier = 1;
                }

                $str .= str_repeat(' ', $multiplier);
            }

            if ($child->hasChildNodes()) {
                $str .= $this->scanElementForText($child);
            }
        }

        return $str;
    }
protected function scanElementForText ( \ DOMNode $ element ) { $ str = '' ; foreach ( $ element -> childNodes as $ child ) { /** @var \DOMNode $child */ if ( $ child -> nodeType == XML_TEXT_NODE ) { $ str .= $ child -> nodeValue ; } elseif ( $ child -> nodeType == XML_ELEMENT_NODE && $ child -> nodeName == 'text:s' ) { // It's a space // Multiple spaces? /** @var \DOMAttr $cAttr */ $ cAttr = $ child -> attributes -> getNamedItem ( 'c' ) ; if ( $ cAttr ) { $ multiplier = ( int ) $ cAttr -> nodeValue ; } else { $ multiplier = 1 ; } $ str .= str_repeat ( ' ' , $ multiplier ) ; } if ( $ child -> hasChildNodes ( ) ) { $ str .= $ this -> scanElementForText ( $ child ) ; } } return $ str ; }
Recursively scan element.

@param \DOMNode $element

@return string
Recursively scan element .