Text disappears when opening a SVG

Asked by Rune

Hello, opening this file https://en.wikipedia.org/wiki/File%3aActivity_conducting.svg with Inkscape 0.91 (just downloaded).
Apparently the file is originally created with inkscape (as of the xmlns tags) but the text in the boxes is not visible.
Any explanation?
Rune

=====
Direct link to SVG:
https://upload.wikimedia.org/wikipedia/commons/e/e7/Activity_conducting.svg

Question information

Language:
English Edit question
Status:
Solved
For:
Inkscape Edit question
Assignee:
No assignee Edit question
Solved by:
Rune
Solved:
Last query:
Last reply:
Revision history for this message
su_v (suv-lp) said :
#1

Can't reproduce - the text renders just fine in Inkscape 0.91 r13725 (on OS X 10.7.5)

Screenshot:
https://dl.dropboxusercontent.com/u/65084033/answers/272642-invisible-text/screenshot-Inkscape-0.91-r13725-osx.png

Which OS do you use?

Revision history for this message
Rune (thorsenrune1) said :
#2

Thank you for your interest, because I face this problem with nearly all SVG that I open. I am on windows 7 having installed inkscape 0.91 r13725. The SVG opens just fine in Chrome https://sourceforge.net/projects/abclogico/files/temp/chrome.jpg/download
the SVG is here :https://sourceforge.net/projects/abclogico/files/temp/test.svg/download

however in Inkscape the texts are not there.
https://sourceforge.net/projects/abclogico/files/temp/inkscape.jpg/download
(Sorry I know its not an appropriate place but right now I did not know where to upload the files)
If I save immediately from Inkscape the texts seems to have been stripped from the svg file.

I have just started trying inkscape. Is it possible that there is some weird setting that hides the text?
I hope you can help solve the problem since its a nogo for using inkscape for me since I needed to create some flowcharts.
Best regards
Rune

Revision history for this message
su_v (suv-lp) said :
#3

How did you download the file ( https://upload.wikimedia.org/wikipedia/commons/e/e7/Activity_conducting.svg )? The uploaded copy 'test.svg' does have an empty first line added, and changed line endings (original: Linux (LF), test.svg: Windows (CRLF)).

I don't know why or which software used for downloading the SVG file from wikimedia added the first empty line, but it does actually break the file, and browsers like Firefox, Chromium and Safari won't even load it because of this change:

 error on line 2 at column 6: XML declaration allowed only at the start of the document

Inkscape complains about the same error:

 parser error : XML declaration allowed only at the start of the document

and apparently completely fails parsing half-way through the content when loading the file directly (e.g. via file manager) up to and including path 'path4987', but nothing after that.

If I query the file types in the terminal (on OS X), this is the information retrieved:
Activity_conducting.svg: SVG Scalable Vector Graphics image
test.svg: exported SGML document text

I would recommend to investigate and make sure that downloaded SVG files are saved unmodified to the local hard drive.

Revision history for this message
Rune (thorsenrune1) said :
#4

Thank you for your answer, I think I just downloaded the file with Chrome.
I removed the first line and changed the lineendings and now it works.
That sounds very delicate that an empty first line and the difference between line endings LF/CRLF makes such a difference, but given that you need to be expert user to catch it I would consider it as a bug that should be fixed. At the very least the user should be notified when loading the file. How did you know about the parser error?
I assume it should be a 2 line job to strip out empty lines and convert line endings.
The funny thing is that neither firefox or chrome seems to notice the difference.

Bottom line, this should definitely be a note in a troubleshooting guide and it should be fixed as a bug.
Thank you and have a good day

Revision history for this message
su_v (suv-lp) said :
#5

The line endings don't matter - it's the first line which was changed on the user's end (outside of and unrelated to Inkscape) and this seemingly minor change does invalidate the SVG file (all SVG viewers I tested agree on this). Inkscape outputs the messages about the parser error to the console (I can't tell you how to access console messages on Windows apart from launching Inkscape from the command line - other OS like Linux and OS X do have system logs, and ship with tools to view the content of those logs).

I will investigate why Inkscape (0.48.5 and later) no longer stops loading the file after the initial parser error about the first line (Inkscape <= 0.48.4 fails to load it and notifies the user accordingly with a message dialog), and why Inkscape 0.91 (as well as current development builds) differ depending on how the file was opened (if from within Inkscape, all content is parsed and rendered, despite the parser errors; if opened via command line argument or file manager, the content is rendered up to but not including the first text element which triggers the second parser error ("Opening and ending tag mismatch: svg line 5 and text") due to the first one), and file a bug report if indicated.

Revision history for this message
su_v (suv-lp) said :
#6

On 2015-10-22 24:47 (+0200), ~suv wrote:
> The line endings don't matter - it's the first line (…)

Sorry, that detail was incorrect: the second parser error wrt to the text element (which causes parts of the file to be omitted) happens indeed only with both modifications in place (empty first line, CRLF line endings).

Revision history for this message
Rune (thorsenrune1) said :
#7

Ok, thanks I learned something thanks to you:
Be careful when copying the SVG code:
1. first line cannot be empty
2. maybe line ending format is an issue causing loss of content (maybe when saving from a browser or opening/saving in notepad)
3. You may not be warned about loosing some content

Rune