xlink namespace error on importing existing svg

Bug #166199 reported by Bug Importer
16
Affects Status Importance Assigned to Milestone
Inkscape
Triaged
Medium
Jon A. Cruz

Bug Description

I'm just starting to try out Inkscape and started off
by opening some of my existing SVG documents that I
created under WebDraw from Jasc Software. When I open
the documents a receive a lot of errors protesting that
there are undefined namespaces.

e.g.
53: namespace error : Namespace prefix xlink for href
on use is not defined <use
xlink:href="#nav_button_complete" y="196"/>

I receive similar errors for many other lines. Once
the file is actually opened it then displays
incorrectly as if the objects that that the output
compains about are not being used in the display.

I have attached a file for upload that was experiencing
these errors. Please contact me by email if you have
additional questions. Additionally, I thought you
might like to know this is occuring on in a Windows
2000 environment.

Thanks,
     BigTunaCan
     joiey.seeley[at]gmail.com

Tags: svg
Revision history for this message
Bug Importer (bug-importer) wrote :
Revision history for this message
Buliabyak-users (buliabyak-users) wrote :

Just need to force libxml into reading the external DTD subset.

Revision history for this message
Jon A. Cruz (jon-joncruz) wrote :

This later manifested as bug 1159405 "Error opening SVGs
with (embedded?) bitmap"

Revision history for this message
Arondylos (arondylos) wrote :

This missing feature also prevents Corel
DRAW11-exported SVGs to not load images[*].
Unfortunately, inkscape's own sodipodi:absref uses
(as the name implies) absolute paths, so a direct
transformation is probably not possible.

[*] Missing support for CSS styles is also a problem,
but at least you can switch CSS style usage off in the
SVG export dialog of CDraw11.

Revision history for this message
Arondylos (arondylos) wrote :

Ugh. I've been digging a little deeper into the problems with
CorelDRAW11-exported files. The "wrong namespace"
issue can be solved by simply adding a
xmlns:xlink="http://www.w3.org/1999/xlink"
reference to the svg header tag.

Then, the second problem is the directory separator used in
Windows-Corel-exported files: the backslash. At least on a
UNIX/Linux filesystem like ext3, inkscape does not load this.
I've had a short look at the xlink standard. However, I was
slightly unsure how to find a reference to the directory
separator specification. So, I cannot state whether not
interpreting backslash as a dir separator is a bug in
inkscape or in the exported SVG.

-Malte

(fixing this manually results in good-looking SVG's in
inkscape here! Yay!)

Revision history for this message
Arondylos (arondylos) wrote :

The URI spec does not mention backslashes, only slashes
as hierarchy separators.
(http://www.rfc-editor.org/rfc/rfc2396.txt)

So, it is a bug in the Corel-exported SVG.

Now the question is how to proceed. Add a hack to switch
\'s into slashes and the missing namespace spec when you
find "<!-- Creator: CorelDRAW -->" in the file?

Well. I'll attach a sample Corel file. Should I also reopen
another bug with a different subject? ("Feature request:
import buggy CorelDRAW svg's"?)

Revision history for this message
Arondylos (arondylos) wrote :

Hmm. How do I actually submit attachments to non-new issues?
Anyway, you can find the file (hereby put in the public domain) on the
WWW:
http://www.usta.de/RefAk/Aussen/privat/test.svg

(without the actual images; I don't own the copyright on all of those
anyway)

-Malte

Revision history for this message
Arondylos (arondylos) wrote :

BTW, a short bash script attempting to automatically fix the issues for
CorelDRAW svgs follows. It's a quick and dirty hack and might eat all
your files.

--snip--
#!/bin/bash

if grep -q "<!-- Creator: CorelDRAW -->" $1
then
        echo "Corel DRAW SVG - proceeding"
        if grep -q "xmlns:xlink" $1
        then echo "already has xlink namespace definition - not adding"
        else
                echo "adding xlink namespace definition"
                sed -i -e 's/svg xmlns=/svg xmlns:xlink="http:
\/\/www.w3.org\/1999\/xlink" xmlns=/' $1
        fi
        echo "converting *all* backslashes to slashes (very risky)"
        sed -i -e 's/\\/\//g' $1
else echo "Not a Corel DRAW SVG apparently"
fi

Revision history for this message
Buliabyak-users (buliabyak-users) wrote :
Revision history for this message
Mental-users (mental-users) wrote :

We should ship with a copy of the SVG DTD and set it up
appropriately with a catalog, I think. So libxml can pull
from our local copy rather than trying to grab it via HTTP.

If we read the SVG, these things should just work.

We could, in principle, assume the xlink namespace if the
xlink prefix is not already bound to anything, but I'm not
certain how good an idea that is. Comments from others?

Revision history for this message
Buliabyak-users (buliabyak-users) wrote :

If someone know how to tell libxml to use XLink namespace
URL without giving it complete DTD, I'm all for it. You know
I hate DTDs (and this bug is yet another reason to hate them).

Revision history for this message
Matiphas-users (matiphas-users) wrote :

The attached file is opened without any error/warning in win
XP, with the svn build from 26July2006 (from
inkscape.modevia.org). (this package contains libxml2)

Revision history for this message
Buliabyak-users (buliabyak-users) wrote :

matiphas: that's perhaps because windows does not show any
warnings at all. Here on linux, it's the same as before, no
progress.

Hystrix (hystrix-)
Changed in inkscape:
status: New → Confirmed
Revision history for this message
Beluga (buovjaga) wrote :

No errors opening the file on Ubuntu 16.04 64-bit, Inkscape 0.91 r13725

Revision history for this message
jazzynico (jazzynico) wrote :

Reproduced on Xubuntu 16.04 (64-bit), Inkscape 0.91.
@beluga, you must run Inkscape from a command line to see the error messages.

Even worse, it now crash the application with trunk rev. 15046.

Changed in inkscape:
status: Confirmed → Triaged
Revision history for this message
jazzynico (jazzynico) wrote :

Follow-up report:
bug #1611672 "Crash when opening file with xlink namespace errors".
<https://bugs.launchpad.net/inkscape/+bug/1611672>

Doesn't affect the 0.92.x branch.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Bug attachments

Remote bug watches

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