GNOME Bugzilla – Bug 132597
xinclude xinclude, 2nd-level entites are not expanded
Last modified: 2009-08-15 18:40:50 UTC
Code is from CVS, 26 January 2004 Having documents: ----- <document.xml> <doc> <title>Main Document</title> <xi:include href="included.xml" xmlns:xi="http://www.w3.org/2003/XInclude"/> </doc> ----- </document.xml> ----- <included.xml> <!DOCTYPE doc [ <!ENTITY INC "Included"> ]> <doc> <title>&INC; Document</title> <xi:include href="subincluded.xml" xmlns:xi="http://www.w3.org/2003/XInclude"/> </doc> ----- </included.xml> ----- <subincluded.xml> <!DOCTYPE doc [ <!ENTITY SUB "Sub"> ]> <doc> <title>&SUB; Included Document</title> </doc> ----- </subincluded.xml> Processing XInclude with entity expansion (btw, as I remember but not sure, entities in xincluded infosets must be expanded by specification): ----- <screen> $ ~/p/libxml/bin/xmllint --xinclude --noent document.xml <?xml version="1.0"?> <!DOCTYPE doc [ <!ENTITY INC "Included"> ]> <doc> <title>Main Document</title> <doc> <title>Included Document</title> <doc> <title>&SUB; Included Document</title> </doc> </doc> </doc> ----- </screen> Problem is: entity "SUB" is not expanded (but "INC" is expanded).
This problem is already set as a "TODO" item (see xinclude.c:2156). I am therefore changing the severity to "enhancement" (meaning that I'll treat the priority as lower than fixing errors / crashes), but I'll try to add the necessary code before the next general release.
Thank you for commenting the issue, but I'd like to say that it is indeed not an enhancement, but a critical functionality. Let me explain. There is a CMS system for documentation. It is component-based. Final documents are assembled from reusable fragments. Documents have cross-references. In order to have unique IDs across the whole texts, each text component starts with definition of the entity "BASEID", and all ID values in the component start with "&BASEID;". If entities expansion during xinclude not works, the system not works.
I apologize for the rather long time it took to get this one fixed. Please try the corrected source in CVS (xinclude.c) bill@billsuper bug132597 $ xmllint --xinclude --noent document.xml <?xml version="1.0"?> <!DOCTYPE doc [ <!ENTITY INC "Included"> ]> <doc> <title>Main Document</title> <doc> <title>Included Document</title> <doc> <title>Sub Included Document</title> </doc> </doc> </doc>
This should be closed by release of libxml2-2.6.8, thanks, Daniel