src/Decoder.php
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;
    }
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;
    }
Read a node from the document and throw
an exception if it is not a text node.
Otherwise, return its content.

\param XMLReader $reader
Reader object the node will be read from.

\retval string
The value of the text node.

\throw InvalidArgumentException
Thrown whenever one of the following
conditions is met:
- We reached the end of the document.
- The next node was not a text node.