Number: 118
Title: Problems with the SVG driver
Submitter: Nick Efthymiou
Date: 24 Mar 2002
Subsys: dot
Version: 1.8.2
System: *-*-*
Severity: major
Problem:
I ran into some trouble when trying to process the sample graphs generated by the SVG driver used in dot and neato. I used this tool: http://www.jasc.com/products/webdraw/ and it refused to load some files (see attachment "WebDraw-complaints" for details).

I then tested the output against the W3C DTD using xmllint, my favourite xml "lint" program, and it pinpointed two root causes: 1. Some graphs are really multigraphs, there are duplicate edges. The SVG driver then assigns the same value to more than one <g> element's id attribute. This causes programs that rely on unique id's (such as webdraw) to fail. (Note aside: the Adobe viewer doesn't rely on the id and renders the output from dot just fine).

2. The value of the id attribute must be an SGML "ID", which means the first character of the value can't be a number. This violation of the validity constraint for ID, see http://www.w3.org/TR/2000/REC-xml-20001006#id , doesn't affect WebDraw, but it does mess up "XML Spy", which is a very useful editor for XML content.

Anyway, attachment "PATCH_svggen" contains diff -c output that can be applied to svggen.c and tries to fix these 2 issues. My "unique-making" approach is "lame", but works: I append a 4-digit random number to the ID. To fix issue#2, I prefix svg strings that will be output as values of an id attribute with an "N".

The patch also enables output for the DOCTYPE which was #ifdef'd away. The new PUBLIC identifier and URI seem to work (tested with the Adobe viewer and webdraw).

Thanks for the great tool!
Output file: b118.txt
Fix: Here
Owner: ellson
Status: Fixed (25 March 2002)