Re: [xml] XInclude fallback and missing root element



On Thu, Nov 23, 2006 at 06:50:39PM +1100, Michael Day wrote:
Hi,

Funny things can happen when XInclude processing is run on a document 
that has an include as the root element. For example:

     <xi:include xmlns:xi="http://www.w3.org/2003/XInclude";
       href="no-such-file.xml">
         <xi:fallback>Foo.</xi:fallback>
     </xi:include>

Running "xmllint --xinclude" on this document produces this output:

     <?xml version="1.0"?>

     Foo.

Which doesn't look like well-formed XML to me. Manipulating the document 
with the tree functions will find that there is no root element in this 
document at all after XInclude processing has taken place. Seems a bit odd!

Is there something better that libxml2 could do in this situation? Or is 
this a gap in the XInclude specification?

Paragraph 3 of section 4.5:
  http://www.w3.org/TR/xinclude/#creating-result
------------------------------------------
It is a fatal error to attempt to replace an xi:include element appearing
as the document (top-level) element in the source infoset with something
other than a list of zero or more comments, zero or more processing
instructions, and one element.
------------------------------------------

I guess it's a bug in libxml2 implementation :-)

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/



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