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;
    }
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;
    }
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 ; }
Converts an XML string into a SimpleXMLElement object

@param string $xmlString      String of well-formed XML
@param string $simpleXMLClass Optional parameter to specify classname of
the return object. That class should extend the SimpleXMLElement class.

@return SimpleXMLElement Object of specified class
@throws SimpleXMLParserException upon parse error, or class
not found for {@link $simpleXMLClass}
Converts an XML string into a SimpleXMLElement object