Re: [xml] XInclude anomality ...



On Tue, Nov 02, 2010 at 11:25:11AM +0000, Ralf Mattes wrote:
Hello list,

I'm trying to understand a strange behavior of libxml2's XInclude
implementation. Given the following fragment:

 ...
 <xi:include href="book.xml" xpointer="xpointer(//author)" >
   <xi:fallback>No authors for this book ... </xi:fallback>
 </xi:include>

If book.xml doesn't exist the fallback will kick in and everything
works as expected, but if book.xml does exist but the xpointer doesn't
return any nodes the inclusion fails with the following error message:

  
: XPointer evaluation failed: #xpointer(//author)
: could not load /tmp/book.xml, and no fallback was found

Is this a quirk in the specs (but then the error message would be utterly
misleading) of a bug in the implementation?

  That sounds like a bug, but while I get the error, the content seems
correct to me with libxml2 from git:

paphio:~/XML -> xmllint --xinclude tst.xml 
tst.xml:2: element include: XInclude error : XPointer evaluation failed:
#xpointer(//author)
tst.xml:2: element include: XInclude error : could not load book.xml,
and no fallback was found
<?xml version="1.0"?>
<inc xmlns:xi="http://www.w3.org/2001/XInclude";>
  No authors for this book ... 
</inc>
paphio:~/XML -> 

  So except for the second line of error which is wrong the processing
however seems correct,

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel veillard com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/



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