[xml] [PATCH] Core dump while using XInclude



Le Thu, May 24, 2001 at 06:26:32PM +0200, Raphael Hertzog écrivait:
I found a core dump but I've not yet been able to produce a simple
test case to show it. However I can provide the files (not very small and

I've been able to produce one after a gdb run. The problem is when you
try to include files that have a DTD declaration (<!DOCTYPE ...>). Files
are attached. Put them in a directory and launch :
$ xmllint --xinclude test.xml

There's even a comment about it in the source (xinclude.c line 410) :
     408         /*
     409          * Add the top children list as the replacement copy.
     410          * ISSUE: seems we should scrap DTD info from the copied list.
     411          */

The problem is that xmlCopyNodeList calls xmlStaticCopyNodeList with
params doc and parent as NULL. And those pointers are used by
xmlStaticCopyNodeList when it tries to copy XML_DTD_NODE nodes
(tree.c line 2750).

I've tried a patch. It's joined. Please check it carefully because I'm not
very used to libxml. While it solves my problem, it may introduce some
other subtle ones.

I removed the XML_DTD_NODE from the doc only if it's a external document.
I don't want to change the main document itself. Hopefully nobody will
ever have the scary idea to use xinclude to copy the DTD declaration from
the very same document.

Another possible idea would have been to silently ignore DTD nodes in
xmlStaticCopyNode if doc pointer was NULL. I don't know which one is best.



Another point now. There seems to be issues with Xinclude and validating
against DTD. The problem is quite simple. The validation is done before
xinclude processing so I get this kind of error :
Expecting (info , module+), got (info include include )

And of course, each include element corresponds to a doc which root's node
is a "module". The final document is DTD compliant but not the one
before xinclude processing.

Would it be possible to launch the validation after the xinclude
processing ? I still need the DTD to be read at the beginning because of
the DTD entities but i'd like that the validation be postponed until
after xinclude processing.


Cheers,
-- 
Raphaël Hertzog -+- http://strasbourg.linuxfr.org/~raphael/
Le bouche à oreille du Net : http://www.beetell.com
Naviguez sans se fatiguer à chercher : http://www.deenoo.com
Formation Linux et logiciel libre : http://www.logidee.com

Attachment: test.xml
Description: Text Data

Attachment: test2.xml
Description: Text Data

Attachment: test.dtd
Description: Text document

Attachment: xinclude.patch
Description: Text document



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]