SVG image not recognized or SVG error message is shown
Opera has added support for the SVG graphics format beginning with version 8, except for some phone products. Like HTML, but unlike graphics formats such as PNG or JPEG, SVG is a markup language that can be edited by hand by changing the source code. Sometimes a specic error will prevent an SVG image from being displayed.
Problem: The image doesn't have the SVG namespace
Symptom: Opera 8.0: Image not displayed. Opera 8.01+ and Opera 9: SVG error message in the message console.
From Opera 8.01, SVG images without the correct namespace attribute but with the SVG content type (image/svg+xml) will be recognized as SVG. These images are still not valid: SVG images must have the namespace.
Fix: Add xmlns="http://www.w3.org/2000/svg" to the <svg> tag, for instance <svg xmlns="http:// www.w3.org/2000/svg">
Very rarely the "xmlns" namespace attribute is not on the "svg" element or it is in the form of "xmlns:some-word" (like "xmlns:svg"). This is valid and Opera supports it, but it will require some deeper knowledge about XML namespaces to fix the error.
Problem: XML well-formedness error
Symptom: An XML error message is shown
SVG is an XML-based format and there are some fundamental XML rules called "well-formedness" that are not allowed to be broken. If they are such errors the processing of the image must stop.
Fix: The image is broken and must be fixed. There is no work-around.
Problem: Unsupported SVG content
Symptom: The SVG image is not displayed
SVG has different versions (1.0, 1.1, 1.2 is in the works) and different profiles (Full, Basic, Tiny). Opera 8.* supports an extension of SVG 1.1 Tiny. Opera 9 supports 1.1 Basic. Different versions and profiles have different allowed content.
In XHTML unknown content is ignored, part of a process called "degrading gracefully". In SVG a rule similar to XML well-formedness prevents us from showing any content at all is the SVG image has any unknown content. If that rule is changed we can do a best effort to display the image, with typically minor degradation due to the unsupported content.
Fix: The only reliable workaround is to code for the lowest common denominator, that is use SVG 1.1 Tiny if you want to support Opera 8.*. HTML 'object' fallback won't work since these versions are all SVG. Browser sniffing and manual fallback is possible, but this is cumbersome and risky.
Search our knowledge base:
