SVG is a standard. Content makes or breaks a standard. Much of the SVG content found on the web is invalid, holding the standard back.

SVG 1.2 won't use a DTD anymore, but something that makes it easier to validate SVG. It will take a little while before SVG 1.2 Full is out and a whole lot longer before everybody and everything upgraded. We can't wait that long.

What are the challenges and solutions/workarounds:

  1. needs a DOCTYPE, while some SVG viewers 'prefer' none.
There's an option to enforce a doctype however
This validator doesn't detect many errors.
  1. does better detect errors, but only works on SVG1.0 content.
  2. Having to figure out what version you're dealing with and finding the right validatorURL with it is a hassle.
The power of is that it's one easy URL to remember.
It's easy to automatically check the version attribute of the SVG content and accordingly sent it of to the right validator
  • Much SVG content uses more namespaces than just those of SVG, XLink, XML and XML Namespaces alone.
(Inkscape uses it to store some application specific information (see the "inkscape:" prefix occurences), stores the license of the content, and as the web becomes more of a semantic web RDF and other notations will make 'extra' namespaces within SVG content even more common)
Though SVG viewers should just ignore those 'foreign' namespace content bits, the validator does not.
A 'solution' is filtering out those bits, for example with some SAX parsing
  1. Next to detecting errors against the standard, the/a validator could have extras:
    • guessing the fix: For example "viewbox is an invalid attribute, viewBox however is"
    • viewer specific hints: "if in your viewBox attribute you replace the commas with spaces it makes ASV3* interpret it right too"
  (*ASV3: Adobe SVG Viewer 3, an ancient SVG viewer, still much in use though by users of Internet Explorer(the only big browser not having SVG support 'out of the box'))

OSDL (Open Source Developers Lab) is working on getting SVG validation as part of a bigger testing framework

Last modified on 26 October 2006, at 19:30