concrete/src/File/Image/Svg/Sanitizer.php
protected function dataToXml($data)
    {
        if (!is_string($data)) {
            throw SanitizerException::create(SanitizerException::ERROR_FAILED_TO_PARSE_XML);
        }
        $xml = new DOMDocument();
        $error = null;
        try {
            $loaded = $xml->loadXML($data, $this->getLoadFlags());
        } catch (Exception $x) {
            $error = $x;
        } catch (Throwable $x) {
            $error = $x;
        }
        if ($error !== null || $loaded === false) {
            throw SanitizerException::create(SanitizerException::ERROR_FAILED_TO_PARSE_XML, $error ? $error->getMessage() : '');
        }

        return $xml;
    }
protected function dataToXml($data)
    {
        if (!is_string($data)) {
            throw SanitizerException::create(SanitizerException::ERROR_FAILED_TO_PARSE_XML);
        }
        $xml = new DOMDocument();
        $error = null;
        try {
            $loaded = $xml->loadXML($data, $this->getLoadFlags());
        } catch (Exception $x) {
            $error = $x;
        } catch (Throwable $x) {
            $error = $x;
        }
        if ($error !== null || $loaded === false) {
            throw SanitizerException::create(SanitizerException::ERROR_FAILED_TO_PARSE_XML, $error ? $error->getMessage() : '');
        }

        return $xml;
    }
protected function dataToXml ( $ data ) { if ( ! is_string ( $ data ) ) { throw SanitizerException :: create ( SanitizerException :: ERROR_FAILED_TO_PARSE_XML ) ; } $ xml = new DOMDocument ( ) ; $ error = null ; try { $ loaded = $ xml -> loadXML ( $ data , $ this -> getLoadFlags ( ) ) ; } catch ( Exception $ x ) { $ error = $ x ; } catch ( Throwable $ x ) { $ error = $ x ; } if ( $ error !== null || $ loaded === false ) { throw SanitizerException :: create ( SanitizerException :: ERROR_FAILED_TO_PARSE_XML , $ error ? $ error -> getMessage ( ) : '' ) ; } return $ xml ; }
Create a DOMDocument instance from a string.

@param string $data

@throws \Concrete\Core\File\Image\Svg\SanitizerException in case of errors

@return \DOMDocument
Create a DOMDocument instance from a string .