Reputation: 3294
I have went through a lot of similar questions.i couldn't find an answer to my problem.
I have an svg image
.I'm trying to get contents from it by using SimpleXMLElement
.
$svgimage = path to svg image;
$svgString=file_get_contents($svgimage) ;//returns image
$svg = new SimpleXMLElement( $svgString );//returns nothing
I have been using a 300dpi
image as background of svg image.Now i changed it to 600dpi
.After that $svg
returns nothing.I have no idea why SimpleXMLElement doesn't work on 600dpi.
Error Log
Warning: SimpleXMLElement::__construct(): Entity: line 29: parser error : AttValue length too longWarning: SimpleXMLElement::__construct():
xlink:href="data:image/x-ms-bmp;base64,Qk1mDokAAAAAADYAAAAoAAAAZQgAAHEFAAABWarning: 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
Any kind of help would be appreciated.
Upvotes: 2
Views: 508
Reputation: 3294
Finally i have resolved this issue.
simplexml_load_string($xml, 'SimpleXMLElement', LIBXML_COMPACT | LIBXML_PARSEHUGE)
LIBXML_PARSEHUGE was it! I don't know how, but I missed it earlier.
Upvotes: 3