SVGvalidation
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:
- validator.w3.org 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.
- jiggles.w3.org/svgvalidator does better detect errors, but only works on SVG1.0 content.
- Having to figure out what version you're dealing with and finding the right validatorURL with it is a hassle.
The power of validator.w3.org 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), openclipart.org 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
- 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 http://openclipart.org/wiki/SVG_Testing#Open_Clip_Art_Library_SVG_Tools