protected function getCurrentNode()
    {
        // Clear the libXML error buffer
        libxml_clear_errors();

        $node = @$this->reader->expand();

        $error = libxml_get_last_error();

        if ($error instanceof LibXMLError) {
            // Only throw exceptions when the level is ERROR or FATAL
            if ($error->level > LIBXML_ERR_WARNING) {
                throw new EssenceException(sprintf('%s @ line #%d [%s]', trim($error->message), $error->line, $this->current), $error->code);
            }
        }

        try {
            return $this->doc->importNode($node, true);
        } catch (DOMException $e) {
            throw new EssenceException('Node import failed', 0, $e);
        }
    }