Box\Spout\Reader\XLSX\Helper\SharedStringsHelper::processSharedStringsItem PHP Method

processSharedStringsItem() protected method

Processes the shared strings item XML node which the given XML reader is positioned on.
protected processSharedStringsItem ( Box\Spout\Reader\Wrapper\XMLReader $xmlReader, integer $sharedStringIndex, Box\Spout\Common\Escaper\XLSX $escaper ) : void
$xmlReader Box\Spout\Reader\Wrapper\XMLReader
$sharedStringIndex integer Index of the processed shared strings item
$escaper Box\Spout\Common\Escaper\XLSX Helper to escape values
return void
    protected function processSharedStringsItem($xmlReader, $sharedStringIndex, $escaper)
    {
        $node = $this->getSimpleXmlElementNodeFromXMLReader($xmlReader);
        $node->registerXPathNamespace('ns', self::MAIN_NAMESPACE_FOR_SHARED_STRINGS_XML);
        // removes nodes that should not be read, like the pronunciation of the Kanji characters
        $cleanNode = $this->removeSuperfluousTextNodes($node);
        // find all text nodes "t"; there can be multiple if the cell contains formatting
        $textNodes = $cleanNode->xpath('//ns:t');
        $textValue = $this->extractTextValueForNodes($textNodes);
        $unescapedTextValue = $escaper->unescape($textValue);
        $this->cachingStrategy->addStringForIndex($unescapedTextValue, $sharedStringIndex);
    }