protected function parseText($reader)
    {
        $node = $this->readNode($reader);

        $type = $node->nodeType;
        if ($type !== \XMLReader::TEXT) {
            $type = isset(self::$types[$type]) ? self::$types[$type] : "#$type";
            throw new \InvalidArgumentException(
                "Expected a text node, but got ".
                "a node of type $type instead"
            );
        }

        $value = $node->value;
        $this->prepareNextNode();
        return $value;
    }