I am using Inkscape 0.48 (on Mac OS X under X11) to create resources for a video game. A feature I am making heavy use of is the ability to add custom attributes to the XML elements within the SVG document-- I have defined a bunch of attributes like polycode:density="" which are meaningless to Inkscape but my game code knows how to interpret, and I add them to the document using Inkscape's "xml editor" window. This works fine but I am having a problem.
Some of my custom attributes contain very long blocks of multiline text, specifically they contain scripts written in Lua. What I find is that Inkscape allows me to put multi-line text into an xml attribute; and I can save as many times as I want, and the multi-line text remains multi-line; but when I *open* a svg document in Inkscape, at that time *all multi-line xml attributes in the entire document get collapsed down to single lines*, and the next time I save all of my xml attributes are single line. This is extremely inconvenient, it confuses my source control and also it could break my code at some point.
Why is Inkscape doing this, and how do I make it stop?
What I've tried so far: I tried setting an xml:space=preserve attribute on the toplevel svg:svg element in the effected document, but this did not help, it did things to the whitespace * between * elements and broke the display in the XML Editor window, but it did not change Inkscape's behavior wrt whitespace in attributes.
Previously, I had a problem where at the same point in time that Inkscape is now eating my whitespace (document open), it was also stripping my custom polycode: namespace prefixes. I eventually fixed this by adding a xmlns:polycode="http://msm.runhello.com/local/svg/polycode0" attribute to the top of each document containing polycode: attributes. (The URL listed is not a valid URL, it's a 404.) Looking on the internet, I got the impression that if I can get Inkscape to load a "DTD" for my polycode: namespace, I can mark in the DTD that the attributes for which I do NOT want whitespace eaten are "CDATA" and this is supposed to make Inkscape leave those attributes alone. However, the document explaining thishttp://msdn.microsoft.com/en-us/library/ms256097.aspx also suggested xml parsers like Inkscape should assume any attribute they do not recognize to be CDATA. Will creating a DTD solve my whitespace problems? How do I get Inkscape to load the DTD? And are there any examples of Inkscape-compatible DTDs of this sort out there, since I do not have experience with DTDs?
Thanks all.