600dpi 背景上的 SimpleXMLElement Returns null

SimpleXMLElement Returns null on 600dpi background

我经历了很多类似的问题questions.i找不到我的问题的答案。

我有一个 svg image。我正在尝试使用 SimpleXMLElement 从中获取内容。

    $svgimage =  path to svg image;
    $svgString=file_get_contents($svgimage) ;//returns image    

    $svg = new SimpleXMLElement( $svgString );//returns nothing

我一直在使用 300dpi 图像作为 svg 的背景 image.Now 我将其更改为 600dpi。之后 $svg returns nothing.I 不知道为什么 SimpleXMLElement 不能在 600dpi 上工作。

Error Log
Warning: SimpleXMLElement::__construct(): Entity: line 29: parser error : AttValue length too long

Warning: SimpleXMLElement::__construct():
xlink:href="data:image/x-ms-bmp;base64,Qk1mDokAAAAAADYAAAAoAAAAZQgAAHEFAAAB

Warning: SimpleXMLElement::__construct(): Entity: line 29: parser error : attributes construct error

Warning: SimpleXMLElement::__construct(): Entity: line 29: parser error : Couldn't find end of Start Tag image line 20

Warning: SimpleXMLElement::__construct(): Entity: line 709: parser error : internal error: Huge input lookup

Warning: SimpleXMLElement::__construct():
name="order-id"

Size of SVG is 12MB

如有任何帮助,我们将不胜感激。

终于解决了这个问题

simplexml_load_string($xml, 'SimpleXMLElement', LIBXML_COMPACT | LIBXML_PARSEHUGE)

LIBXML_PARSEHUGE是它!不知道怎么弄的,之前就错过了