external DTD subset is not loaded

Bug #165979 reported by Bug Importer on 2004-10-07
10
Affects Status Importance Assigned to Milestone
Inkscape
Medium
Jon A. Cruz
Inkscape Devlibs
Medium
Unassigned

Bug Description

I tried to convert jpg picture to svg via
http://www.enetzwerk.de/svg/index2.html.

Result of this conversion (SVG) is displayed correctly
in borwser (IE, Firefox on windows XP with Adobe SVG
Viewer 3.0), but inkscape 0.39 (on MDK 10.0) opens
empty file.

At the attachment there is example of the converted file.

Zdenko Podobny <zdpo (at) mailbox (dot) sk>

Tags: svg Edit Tag help
Cth103 (cth103) wrote :

Hi,

Thanks for the report. The attachment seems not have
worked; please could you try again?

Make sure you have ticked the "Check to Upload and Attach a
File" box on the form.

Carl

dcberg (david-sipsolutions) wrote :

I asked Zdeno to send me the file and noticed that
everything works fine except that it isn't a svg, really,
but has an embedded jpg. Inkscape obviously can only link
bitmaps right now but ignores embedded stuff.

<image width="133" height="135"
xlink:href="data:image/jpeg;base64,...

is the way it's embedded.
I suggest either renaming this bug, or to open a new one and
close this.

I quickly hat a look at w3c, but couldn't find anything on
this. but then again, it was just a very quick look.

Bryce Harrington (bryce) wrote :

Ah, Inkscape doesn't support embedded bitmaps yet, so will fail
on these types of files. Moving this to the feature request
tracker.

Jon A. Cruz (jon-joncruz) wrote :

This appears to be due to there not being an xmlns spec for
the xlink prefix, but instead counting on the DTD to define
it. At the moment we appear to not be parsing that DTD, and
thus not getting a definition for xlink:href. Simply adding
xmlns:xlink="http://www.w3.org/1999/xlink" to the svg tag is
a work-around.

I looked up libxml docs and added

xmlThrDefLoadExtDtdDefaultValue (1)

to sp_repr_read_file. This is supposed to set the global
option of reading external DTD subset. It does not work
still, for some reason. Maybe a bug in libxml. One problem
is that we use the old API, xmlParseFile, while there's a
newer one, xmlReadFile, which can be passed the
XML_PARSE_DTDLOAD option. I didn't test it because I have an
old libxml which only has xmlParseFile. Maybe if we switch
to newer libxml and start using xmlReadFile with
XML_PARSE_DTDLOAD the problem will go away. If someone's
motivated enough they can test this, or ask around on the
libxml list.

I'm moving this back to bugs. The sample file is attached.

I fixed this by using

            doc = xmlReadFile (localFilename, NULL,
XML_PARSE_RECOVER | XML_PARSE_NOENT | XML_PARSE_DTDLOAD |
XML_PARSE_NONET);

in sp_repr_read_file (see my message in the list for why I
didn't commit this change). However payment-outline.svg
still does not load with that change, with no error message.
I found that the reason for this is the check in
sp_document_new:

  if (strcmp (sp_repr_name (rroot), "svg:svg") != 0) return
NULL;

For this document, which uses some non-primary SVG DTD, the
repr name of the root node turns out to be "ns:svg", not
"svg:svg", so this check fails. Mental, can you please look
into it? Looks like your namespace defaulting does not
always work.

here's the link to the mailing list discussion:

http://sourceforge.net/mailarchive/message.php?msg_id=10679990

Horkana-users (horkana-users) wrote :

See also:
[ 1592292 ] Better support of corel's SVG
https://sourceforge.net/tracker/index.php?func=detail&aid=1592292&group_id=93438&atid=604309
includes example file

Which has been closed as duplicate of this report (although
it is limited to much more specific circumstances). bumping
priority back to 5 since in the duplicate got a logged in
user willing to providing good feedback, priority should
maybe be bumped higher if someone is interested in work on
this or any kind of workaround.

should this be reassigned to menal based on bulias request?

Bryce Harrington (bryce) wrote :

Originator: NO

Could someone confirm that this issue still exists?

vonHalenbach (lustik) wrote :

The attached file opens and displays normal with KSVG, but Inkscape 0.45++ shows only an empty canvas.

Changed in inkscape:
status: New → Confirmed
tags: added: svg
removed: needs-confirm-on-svn-head
Beluga (buovjaga) wrote :

Inkscape opens "sample file with external dtd" fine, it displays the image.

Win 7 64-bit
Inkscape 0.91 r13725

jazzynico (jazzynico) wrote :

Tested on Windows XP (32-bit).
- 0.91 and 0.92.x rev. 15043 both display an empty canvas.
- trunk rev. 14630 with experimental gcc5.1 devlibs works as expected.

So there's something wrong in the official 32-bit devlibs (already fixed in the 64-bit devlibs, updated recently).

Changed in inkscape:
status: Confirmed → Triaged
Changed in inkscape-devlibs:
importance: Undecided → Medium
status: New → Triaged
su_v (suv-lp) wrote :

JazzyNico wrote:
> So there's something wrong in the official 32-bit devlibs ...

... probably another one related to older libxml2 versions:

Testing with last locally archived trunk revision built with outdated as well as with more current version of libxml2 (on OS X 10.7.5):
- reproduced with trunk r14248, libxml2 2.7.8 (empty canvas)
- not reproduced with trunk r14248, libxml2 2.9.3 (bitmap ok)

32bit devlibs for Windows have libxml2 2.7.8, 64bit devlibs have libxml2 2.9.3.

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

Duplicates of this bug

Other bug subscribers

Remote bug watches

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