I’m working with Inkscape to create .svg files used in an OpenHAB-based UI. For compatibility with OpenHAB, text elements must include a <tspan> and custom attributes like openhab="true".
Here’s the issue I’m encountering:
I create a simple SVG with a <rect> and a <text> element (which automatically includes a <tspan>).
Using the XML editor in Inkscape, I:
Change the id of the <rect> and the <tspan>.
Add a custom attribute openhab="true" inside the <tspan>.
I save the file.
However, when I reopen the SVG or check the file with an external text editor:
The id change on the <rect> is correctly saved.
But the <tspan> element:
Still has the original id assigned by Inkscape.
Does not include the openhab="true" attribute I added.
It looks like Inkscape discards manual changes to <tspan> elements upon saving. This behavior breaks our workflow with OpenHAB.
Is this a known issue? Is there a workaround to force Inkscape to retain manual edits inside <tspan>?
Thanks in advance for any suggestions or explanations.
Hi all,
I’m working with Inkscape to create
.svg
files used in an OpenHAB-based UI.For compatibility with OpenHAB, text elements must include a
<tspan>
and custom attributes likeopenhab="true"
.Here’s the issue I’m encountering:
I create a simple SVG with a
<rect>
and a<text>
element (which automatically includes a<tspan>
).Using the XML editor in Inkscape, I:
Change the
id
of the<rect>
and the<tspan>
.Add a custom attribute
openhab="true"
inside the<tspan>
.I save the file.
However, when I reopen the SVG or check the file with an external text editor:
The
id
change on the<rect>
is correctly saved.But the
<tspan>
element:Still has the original
id
assigned by Inkscape.Does not include the
openhab="true"
attribute I added.It looks like Inkscape discards manual changes to
<tspan>
elements upon saving.This behavior breaks our workflow with OpenHAB.
Is this a known issue? Is there a workaround to force Inkscape to retain manual edits inside
<tspan>
?Thanks in advance for any suggestions or explanations.
The SVG validator flags that use of attribute as invalid.
https://validator.w3.org/check
My test file is attached.