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



Daniel,

  
  
I 
have 
modified 
the 
patch 
and 
run 
some 
tests 
under 
various 
conditions 
to 
make 
sure 
the 
results 
are 
what 
I 
expected 
to 
be 
correct.

  
  
I 
modified, 
but 
otherwise 
kept, 
the 
initial 
change 
setting 
the 
local 
variable 
as 
it's 
easier 
to 
check 
for 
an 
empty 
string 
than 
determine 
what 
URL 
the 
current 
file 
is 
and 
try 
comparing 
that 
to 
the 
include 
URL. 
Right 
before 
the 
stack 
check 
I 
added 
an 
additional 
check 
where 
if 
local 
and 
xml 
I 
checked 
for 
a 
non-null 
and 
non-empty 
fragment. 
If 
the 
fragment 
is 
empty 
for 
a 
local 
xml 
include 
I 
give 
a 
recursive 
error. 
I 
was 
a 
little 
unsure 
about 
the 
error 
so 
please 
change 
to 
something 
more 
appropriate 
if 
needed.

  
  
This 
should 
fill 
the 
general 
gap 
of 
enforcing 
the 
optional 
href 
needing 
a 
fragment 
according 
to 
the 
spec.

Chris

----- Original Message ----
From: Daniel Veillard <veillard redhat com>
To: Chris Ryan <xgbe yahoo com>
Cc: xml gnome org
Sent: Wednesday, February 6, 2008 9:14:57 AM
Subject: 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 
error:


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 
appreciated.

  
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
before
  
if 
((!local) 
&& 
(xml 
== 
1)) 
{
and 
extended 
to 
check 
for 
the 
fragment 
value,

Daniel

-- 
Red 
Hat 
Virtualization 
group 
http://redhat.com/virtualization/
Daniel 
Veillard  
  
  
| 
virtualization 
library  
http://libvirt.org/
veillard redhat com  
| 
libxml 
GNOME 
XML 
XSLT 
toolkit  
http://xmlsoft.org/
http://veillard.com/ 
| 
Rpmfind 
RPM 
search 
engine  
http://rpmfind.net/





      ____________________________________________________________________________________
Looking for last minute shopping deals?  
Find them fast with Yahoo! Search.  http://tools.search.yahoo.com/newsearch/category.php?category=shopping

Attachment: xinclude_c.diff
Description: Binary data



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