Re: [xml] Bug/Patch in xinclude when using empty href

On Tue, Feb 05, 2008 at 05:56:14AM -0800, Chris Ryan wrote:
Hello All,

    I've been working with libxml2 and xsltproc to process docbook files. The editor that we use creates 
xinclude tags that use empty href tags when referring to the same file. The problem I am encountering is 
that when using xmllint, or the library in general, in this scenario it warns about a recursion. I've 
attached a sample xml file for demonstration. Running 'xmllint --xinclude a.xml' will produce the following 

a.xml:3: element include: XInclude error : detected a recursion in a.xml

    I was able to determine that the URI was being correctly calculated but that the code was not setting 
the local flag when the href was empty while it was doing so for a missing href or an href starting with a 
# character. I added an additional statement in xinclude.c to check for an empty href and set local to a 
true value and it corrected the problem. I have attached a diff file showing the change for convenience.

    I used the latest version, 2.6.31, for all my testing and changes. I also checked the xinclude spec to 
make sure this was indeed the intended behavior. Your consideration on this issue and submission is greatly 

  Well, the 'local' test is a bit of a hack, reusing it is fair,
but the problem is that it's okay to set it if href="" only if there
is also an xpointer attribute. I think the patch is incomplete without
that test, could you extend it ? The change can probably be moved just
  if ((!local) && (xml == 1)) {
and extended to check for the fragment value,


Red Hat Virtualization group
Daniel Veillard      | virtualization library
veillard redhat com  | libxml GNOME XML XSLT toolkit | Rpmfind RPM search engine

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