
Trying to fix the loading of documents that do not contain xlink namespace declaration but instead rely on external DTD subset to supply it (bugs 1042161 and 1102678), I replaced the xmlParseFile call to the newer xmlReadFile call with these options:
doc = xmlReadFile (localFilename, NULL, XML_PARSE_RECOVER | XML_PARSE_NOENT | XML_PARSE_DTDLOAD)
in sp_repr_read_file. This fixed the namespace bug. However this resulted in loading the external DTD across the network for ALL regular Inkscape files too! This is because all our files contain
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
which is really not necessary at all and even non-compliant (because with our extension elements, we will likely fail validation with that DTD). However that DTD reference is being inserted since Sodipodi times and is now in all old files. And this means that these files will now have a delay on load while libxml fetches the DTD from the net, and will generate an error if you try to load them while network is not available.
So, I did not commit this change, and I'm really not sure what to do about it. Should we try to supply our own catalog to the parser, which would force it to use a local copy of the DTD (which we also must therefore supply)? This sounds like a lot of hassle. Or just forbid the parser to access the net and suppress the error (this is possible)? But then the xlink namespace bugs will remain unfixed.
And can/should we, at least, stop inserting the DOCTYPE in the files we create? It really serves no useful purpose, IMHO.

bulia byak wrote:
So, I did not commit this change, and I'm really not sure what to do about it. Should we try to supply our own catalog to the parser, which would force it to use a local copy of the DTD (which we also must therefore supply)? This sounds like a lot of hassle.
Especially since those URI's in theory are identifiers, this sounds like the way to go.
(late late and sleepy...)
Given past experience with validators way back and other things, this solution seems to feel like the right thing to do. Or at least the lesser of evils.

On Fri, 2005-01-28 at 03:23, bulia byak wrote:
And can/should we, at least, stop inserting the DOCTYPE in the files we create? It really serves no useful purpose, IMHO.
Argh, I thought I'd already fixed that. I can't find any further use of DTDs besides the marker preview documents.
-mental

On Fri, 28 Jan 2005 09:22:16 -0500, MenTaLguY <mental@...3...> wrote:
On Fri, 2005-01-28 at 03:23, bulia byak wrote:
And can/should we, at least, stop inserting the DOCTYPE in the files we create? It really serves no useful purpose, IMHO.
Argh, I thought I'd already fixed that. I can't find any further use of DTDs besides the marker preview documents.
Ah, sorry, indeed. I was looking at an old document. We're clean now :)
So, given that these new documents won't make the parser go to the net, do you think we can enable external DTD loading? If not right now, maybe a few releases from now?

On Fri, 2005-01-28 at 09:26, bulia byak wrote:
Ah, sorry, indeed. I was looking at an old document. We're clean now :)
So, given that these new documents won't make the parser go to the net, do you think we can enable external DTD loading?
No, because users will get SVGs from plenty of other sources that do include a DOCTYPE declaration.
The correct thing to do is to include at least include the basic SVG DTDs in our package, with an appropriate catalog file. See http://www.w3.org/TR/html401/sgml/intro.html for an example of how such a catalog might be prepared.
I unfortunately don't know specifically how to tell libxml to use the catalog. Also, it should be possible to disable loading non-file URIs.
-mental

On Fri, 28 Jan 2005 20:36:03 -0500, MenTaLguY <mental@...3...> wrote:
The correct thing to do is to include at least include the basic SVG DTDs in our package, with an appropriate catalog file. See http://www.w3.org/TR/html401/sgml/intro.html for an example of how such a catalog might be prepared.
Oh my. I always hated DTDs. Every time I meet them, I hate them more and more. Carrying over this stuff from SGML was the biggest mistake of XML creators.
</rant-mode>
participants (3)
-
bulia byak
-
Jon A. Cruz
-
MenTaLguY