Out of two Xml files with the same contents, only one can be opened

Bug #1591578 reported by Florian Haag
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Inkscape
Triaged
Medium
Unassigned

Bug Description

I have saved a very simple Xml file from Inkscape 0.91 (r13725) in Windows 7 x64. When I load this Xml file by means of the XmlDocument class in .NET and save it again, another SVG file is created.

https://www.corefiling.com/opensource/xmldiff.html confirms the original and the copied file have (semantically) the same contents (except for Inkscape writing "UTF-8" when .NET writes "utf-8" into the header, but that doesn't change anything about the problem described below).*

The original file opens flawlessly in Inkscape. The copied file cannot be opened, as Inkscape crashes with the message "Inkscape encountered an internal error and will close now."

I suspect Inkscape is chocking on a valid file, but if this is not a bug, then there must be at least some very obscure issue in the copied file that Microsoft's XML engine can handle while Inkscape fails on it, in which case I consider the uninformative and hence unhelpful error message a bug.

I have attached the following files:

- a.svg: the original file as saved by Inkscape (can be opened in Inkscape)
- b.svg: the copied file as output by .NET (cannot be opened in Inkscape)
- copyxml.cs: The source code of a tiny C# program that, when run in the same directory as a.svg, will copy a.svg to b.svg

* On a side note: https://validator.w3.org/#validate_by_upload says both the original (Inkscape-saved) and the copied file are invalid SVG because allegedly, <flowRoot> elements must not be children of <g> elements. That notwithstanding, both files are well-formed XML according to http://www.xmlvalidation.com/ .

Tags: svg text
Revision history for this message
Florian Haag (florianhaag) wrote :
Revision history for this message
Patrick Storz (ede123) wrote :

Just checked on Windows 10 x64 with the following versions
- Inkscape 0.91 r13725 (latest stable)
- Inkscape 0.92pre1_64bit r14979 (trunk build)

The issue is reproducible with 32 bit builds of both versions.
64 bit builds are not affected.

Revision history for this message
su_v (suv-lp) wrote :

AFAICT nothing OS-specific here - depends on version of libxml2 and the specific formatting of the SVG source within an element which declares 'xml:space="preserve"' (in <flowroot>): inkscape trunk with libxml2 2.7.8 and libxml2 2.8.0 crashes e.g. on OS X too, when attempting to open the "pretty-printed" version b.svg - no crash OTOH with trunk compiled against libxml2 2.9.3.

The trigger seems to be white-space (newlines) inserted in b.svg to separate child elements of the <flowRoot> element.

Deleting the 'xml:space="preserve"' attribute, or removing the specific formatting (the newlines separating the children of <flowRoot>) allows to open the file with Inkscape built against (outdated) libxml2 2.7.8 and 2.8.0 (currently, 32bit devlibs for Windows builds still have libxml2 2.7.8, whereas 64bit devlibs include recent 2.9.3).

What the correct solution would be in the context of the reporter's use case I do not know.

jazzynico (jazzynico)
tags: added: svg text
Changed in inkscape:
status: New → Triaged
importance: Undecided → Medium
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.