svg files not importing to inkscape

Asked by amit

I am getting a svg file that is being exported from cmap tool.when the file is opened using wordpad.The contents of the file are not readable.When this file is imported to inkscape it becomes readable and has format of XML.
Some of these svg files are imported to inkscape but some are not imported.

Question information

Language:
English Edit question
Status:
Answered
For:
Inkscape Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
mahfiaz (mahfiaz) said :
#1

Please see the following answer:
https://answers.launchpad.net/inkscape/+question/49505

Your problem may be similar, try running inkscape from command line as suggested there, to get error messages.

Revision history for this message
mahfiaz (mahfiaz) said :
#2

These files which don't get imported are either malformed or is inkscape having problem interpreting these.
See command-line error messages to find the error (or non-error) and correct it. There is no automagical xml file repairing ATM.
If the opening problem is inkscape's, please file a bug report for it.

Revision history for this message
amit (amit-tripathi1982) said :
#3

I am trying to import the file through command prompt but no error is displayed on the command prompt.
Could you please tell me how to import the file from command prompt.

Revision history for this message
mahfiaz (mahfiaz) said :
#4

Could you upload one not-importing file somewhere and post link here?

Revision history for this message
amit (amit-tripathi1982) said :
#5

Is it possible that I send it to your mail id?If that's possible please give your email id.

Revision history for this message
mahfiaz (mahfiaz) said :
#6

mahfiaz at gmail dot com

Revision history for this message
amit (amit-tripathi1982) said :
#7

Hope you have got the file.

Revision history for this message
mahfiaz (mahfiaz) said :
#8

I got the following output to terminal (command prompt):

me@host:~$ /opt/inkscape-20135/bin/inkscape '/home/me/Desktop/Agropedia_crop.svg'
Agropedia_crop.svg:34: namespace error : Namespace prefix xlink for href on use is not defined
  <use xlink:href="#plus" transform="rotate(45)translate(-51,-51)"/>
                                                                  ^
Agropedia_crop.svg:38: namespace error : Namespace prefix xlink for href on use is not defined
  <use xlink:href="#plus" transform="translate(-50,-50)"/>
                                                        ^
Agropedia_crop.svg:39: namespace error : Namespace prefix xlink for href on use is not defined
  <use xlink:href="#cross" transform="translate(-52,-51)"/>
                                                         ^
Agropedia_crop.svg:57: namespace error : Namespace prefix xlink for href on use is not defined
  <use xlink:href="#triup" transform="rotate(180)translate(-50,-50)"/>
                                                                    ^
Agropedia_crop.svg:61: namespace error : Namespace prefix xlink for href on use is not defined
  <use xlink:href="#box" transform="rotate(45)translate(-50,-50)"/>
                                                                 ^
Agropedia_crop.svg:68: namespace error : Namespace prefix xlink for href on use is not defined
  <use xlink:href="#dot" style="stroke:none;fill:currentColor"/>
                                                              ^
Agropedia_crop.svg:72: namespace error : Namespace prefix xlink for href on use is not defined
  <use xlink:href="#box" style="stroke:none;fill:currentColor"/>
                                                              ^
Agropedia_crop.svg:76: namespace error : Namespace prefix xlink for href on use is not defined
  <use xlink:href="#triup" style="stroke:none;fill:currentColor"/>
                                                                ^
Agropedia_crop.svg:80: namespace error : Namespace prefix xlink for href on use is not defined
  <use xlink:href="#tridn" style="stroke:none;fill:currentColor"/>
                                                                ^
Agropedia_crop.svg:84: namespace error : Namespace prefix xlink for href on use is not defined
  <use xlink:href="#diamond" style="stroke:none;fill:currentColor"/>
                                                                  ^
Agropedia_crop.svg:2345: namespace error : Namespace prefix xlink for href on image is not defined
AAAAAElFTkSuQmCC"/>
                 ^
Agropedia_crop.svg:2450: namespace error : Namespace prefix xlink for href on image is not defined
AAAAAElFTkSuQmCC"/>
                 ^
Agropedia_crop.svg:2592: namespace error : Namespace prefix xlink for href on image is not defined
AAAAAElFTkSuQmCC"/>
                 ^
Agropedia_crop.svg:2734: namespace error : Namespace prefix xlink for href on image is not defined
AAAAAElFTkSuQmCC"/>
                 ^
Agropedia_crop.svg:2915: namespace error : Namespace prefix xlink for href on image is not defined
AAAAAElFTkSuQmCC"/>
                 ^
Agropedia_crop.svg:3162: parser error : Excessive depth in document: change xmlParserMaxDepth = 1024
<g transform="matrix(1.0000,0.0000,0.0000,1.0000,0.0000,0.0000)">
^
Agropedia_crop.svg:3162: parser error : Extra content at the end of the document
<g transform="matrix(1.0000,0.0000,0.0000,1.0000,0.0000,0.0000)">

So I extracted the gzipped svg (got 2.5MB) to see the xml.
And found that this really has deeper nesting than xmlParserMaxDepth=1024
This file has very stupid several groups with transforms, which are almost endlessly nested.

Groups with <g transform="matrix(1.0000,0.0000,0.0000,1.0000,0.0000,0.0000)"> can simply be removed (this is null-transform matrix), but this still is of no help because the nesting remains deeper than 1024. If I find a way, I will let you know.

Revision history for this message
amit (amit-tripathi1982) said :
#9

Could you please tell me how(command) to open the file on inkscape from command prompt?

Revision history for this message
amit (amit-tripathi1982) said :
#10

How have you extracted the gzipped svg?I have sent you the svg file.I haven't zipped it.So how does it got zipped?

Revision history for this message
mahfiaz (mahfiaz) said :
#11

SVG files are plain-text xml files, which can be compressed using gz. This compression is handled transparently. Name your svg to .gz and extract, then you can open the file using any text editor.

Can you help with this problem?

Provide an answer of your own, or ask amit for more information if necessary.

To post a message you must log in.