SVG validity checks

From Meta, a Wikimedia project coordination wiki
Jump to: navigation, search

Out of 2871 randomly-selected SVG files from Commons, 13 (about 0.5%) failed to pass a basic XML well-formedness check. From this sample we might expect about 600-800 invalid files total.

Following are the failed images from my sample set, broken down by type of error. --brion 01:08, 6 February 2008 (UTC)

Contents

[edit] Bad element nesting

This is a blatant well-formedness error. No SVG renderer likes these files, and they don't work on the site as is.

[edit] Bad character encoding

Text in this file is ISO-8859-1, but since there's no XML header declaring this, a conforming XML parser must assume it's UTF-8 and should barf when coming to the non-ASCII bits.

Amusingly, Firefox does render this file, while rsvg doesn't.

[edit] Unbound namespace: xlink

The next couple sections are files which fail to declare all the namespaces used in the document. Possibly these come from bad exporters, or from uncareful manual editing of generated files.

rsvg currently renders these files for you on Wikimedia, but Firefox won't take them if you try to view them inline. I'd consider it reasonable to start rejecting these... but at least some of them would be easy to fix automatically on upload with some sort of lint check.

The xlink namespace is used for links, including internal references within an SVG document, and really ought to be declared when used. :)

[edit] Unbound namespace: sodipodi

Used for various metadata by the SVG editors sodipodi and Inkscape.

[edit] Unbound namespace: RDF

General metadata in some files...

[edit] Unbound namespace: ns

Not too sure what this one's for. Some sort of editing metadata, looks like.

Personal tools

Variants
Actions
Navigation
Community
Beyond the Web
Print/export
Toolbox