Page MenuHomePhabricator

Validate SVG content
Closed, ResolvedPublic



Wikipedia has 16655 pieces of SVG content now (

I bet you quite a bit of that content is not really SVG, valid by the W3C standard.
Please put some QA in place to make all content valid, as otherwise you are
breaking the standard, something that Wikipedia as a proponent of free and easy
exchange of information can't have. has recently started a project like that on which you can build:
Please also help that project improve

Version: unspecified
Severity: enhancement



Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 9:24 PM
bzimport set Reference to bz7645.

ayg wrote:

It should be simple to use XMLReader::isValid() for this on upload time, if it
exists (installed by default with PHP 5.1). The question is what to do if it's
not, outright reject it? We accept invalid HTML for pages, we just clean it up. wrote:

  • Does that XMLreader know how to handle 'extra' namespaces? = For example: A significant part of SVG content on the web has been created

with Inkscape of which the default

Save results in application specific information being added to the document
  • There's more Quality Assurance than just marking something valid or invalid: = errors could have suggestions with it, for example:
    1. "viewbox" not allowed, "viewBox" allowed though = valid content can still get suggestions for improvement:
    2. you don't have a viewBox, but you specify a fixed width and height; your

graphic will be more scalable by

  setting width and height to 100% and the viewBox to 0,0,width,height"
# you use commas in viewBox, replacing them with spaces makes ASV3* correctly

interpret the attribute

*:Adobe SVG Viewer 3, a deprecated but still significantly used viewer

I just added a link to the source in CVS of the earlier mentioned SVG validation tools wrote:

And with testing the 3rd random thing claiming to be SVG i hit an error:
(not showing an image on Firefox, usually that means not having the right
MIME-type or namespace) wrote: has path elements with
empty d attributes, which is strange to the very least and probably wrong.

Assigning SVG bugs to Ariel -- need a cleanup pass to see what's fixed up by a librsvg upgrade, what can be resolved with fixes to our font configuration, what can be fixed on our end, and what still needs to be pushed upstream.

Seems implemented using XmlTypeCheck atm.

Old files might need re-assesment, which is bugzilla:7645

(In reply to comment #6)

Seems implemented using XmlTypeCheck atm.

Old files might need re-assesment, which is bugzilla:7645

XmlTypeCheck only checks that the root element is correct (and in the right namespace), and that the xml document is well formed. It doesn't validate that it really is an svg document. (although its unclear from the original request if a well formed-ness check is sufficient).