OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
XInclude inconsistency ?


I'm not sure what's wrong with XInclude : the spec, the test suite... or 
me ?

While implementing XInclude in RefleX, I encountered something strange 
about loops

The XInclude test suite check that part of the spec in the [eduni-2] 
test case by Richard Tobin, that verifies that xi:include elements in 
the target have been processed in the acquired infoset, ie before the 
xpointer is applied.

Here is the test :
     <include href="book.xml" xpointer="intro"/>
     <include href="book.xml" xpointer="chap1"/>
     <intro id="intro">
         You will enjoy this book.
     <include href="chap1.xml"/>
     <include href="chap2.xml"/>
<chapter id="chap1">
     It was a dark and stormy night.
--------------the result expected
     <intro id="intro" xml:base="book.xml">
         You will enjoy this book.</intro>
     <chapter id="chap1" xml:base="chap1.xml">
         It was a dark and stormy night.

So far, everything seems ok.

Another part of the spec talk about loops :

Which states that A include B include A can work as long as the pointed 
parts of A are not dependant hierarchycally ; exemple :

<root xmlns:xi="http://www.w3.org/2001/XInclude";>
     <p>Include a part of A that include B that include another part of 
     <A><xi:include href="xi2-A-include.xml" parse="xml" 
<rootA xmlns:xi="http://www.w3.org/2001/XInclude";>
     <here>here<B><xi:include href="xi2-B-include.xml" parse="xml" 
<rootB xmlns:xi="http://www.w3.org/2001/XInclude";>
     <somewhere>somewhere<A><xi:include href="xi2-A-include.xml" 
parse="xml" xpointer="xpointer(//there)"/></A></somewhere>
-------------result expected
<root xmlns:xi="http://www.w3.org/2001/XInclude";>
     <p>Include a part of A that include B that include another part of 
To make this example fail, we can simply change the xpointer expression 
in xi2-B-include.xml with "xpointer(//here[2])", which MUST cause a loop 

So far, everything seems ok once again.

However, in my implementation, I first consider the latter case, and 
when I tried to pass the XInclude test suite, the [eduni-2] test case 
fails ; so, I tried to correct the bug, but the changes broke my own 
test (infinite loop).

In fact, I'm not sure that both can work together : the spec says that 
in one hand xpointer have to be resolved on the acquired infoset, that 
is to say that the input target have to be pass through an xinclude 
filter before applying xpointer, and in the other hand that it is 
allowed to have the same input target involved several times if the 
nodes are not hierarchically dependant, which implies that the input 
target mustn't be passed through an xinclude filter before applying 
xpointer, otherwise an infinite loop may occur (because it can't be 

When I fix the bug in one case, it cause a bug in the other.

I tried my theory on another implementation : I suppose that XOM passes 
the test suite (and the [eduni-2] test case), so I just try to resolve 
the inclusion on my example ; I just replace the xpointer() scheme which 
is not supported by XOM with an equivalent element() scheme, and I get 
the result expected, as XOM is certainly implemented to pass the 
[eduni-2] test case, it also resolves correctly my test, but when I 
replace the xpointer expression to cause a loop exception, I get the 
famous infinite loop :
Exception in thread "main" java.lang.StackOverflowError

I bet on an inconsistency in the XInclude spec, because I don't think it 
  is implementable, although I'm not sure. Perhaps there is a solution 
to make the 2 examples working correctly (with the ability to detect the 
loop in the second case).

Some advice ?


              (. .)
|      Philippe Poulard       |
        Have the RefleX !

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 1993-2007 XML.org. This site is hosted by OASIS