public function parseXMLString($xmlString, $simpleXMLClass = 'SimpleXMLExtended')
    {
        libxml_use_internal_errors(true);

        $doc = simplexml_load_string($xmlString, $simpleXMLClass);

        if (false === $doc) {
            $xml = explode("\n", $xmlString);

            $errors = libxml_get_errors();

            $errorString = '';
            foreach ($errors as $error) {
                $errorString .= $this->displayXmlError($error, $xml);
            }

            libxml_clear_errors();

            throw new SimpleXMLParserException("Unable to parse xml string:\n\n".$errorString);
        }

        return $doc;
    }