Forum: Inkscape Inkscape deletes whitespace from my xml attributes?

13d5eaac2b8aa1655f57b9b729734881?d=identicon&s=25 Andi McClure (Guest)
on 2012-01-01 02:10
(Received via mailing list)
I am using Inkscape 0.48 (on Mac OS X under X11) to create resources for
video game. A feature I am making heavy use of is the ability to add
attributes to the XML elements within the SVG document-- I have defined
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
save as many times as I want, and the multi-line text remains
but when I *open* a svg document in Inkscape, at that time *all
xml attributes in the entire document get collapsed down to single
and the next time I save all of my xml attributes are single line. This
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
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
wrt whitespace in attributes.

Previously, I had a problem where at the same point in time that
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="" attribute
the top of each document containing polycode: attributes. (The URL
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
this<> also
suggested xml parsers like Inkscape should assume any attribute they do
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.
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.