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]
Re: [xml-dev] XInclude inconsistency ?

Elliotte Harold wrote:
> Philippe Poulard wrote:
>> 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
> Just to be clear, you have created documents which generate a stack 
> overflow in XOM, correct?


> If so, I'd appreciate it if you could mail me copies of these documents 
> so I can investigate the problem. Thanks.

of course ; you'll find them in attachment

in xi2-B-include.xml, the expression "element(/1/3)" should cause a loop 
exception but it doesn't, and if you replace it with "element(/1/2)" it 
works fine with XOM (that is to say, the expected document is get)

once again, I'm not sure that it's due to XOM particularly, but rather 
to a design error in XInclude ; if you fix that bug in XOM without 
breaking the test suite (and specifically the test case labelled 
[eduni-2]), it simply prooves that I was wrong and that I really need go 
to sleep :)

my thoughts lead me to this big question : as loops can be detected only 
AFTER applying xpointer expressions (my test), how can they be detected 
if the input must be processed entirely BEFORE applying xpointer 
expressions ([eduni-2] test case) ?
so, after or before ?

here is the snippet java code that thrown the exception :


import java.io.IOException;
import java.io.UnsupportedEncodingException;

import javax.xml.parsers.DocumentBuilderFactory;

import nu.xom.Builder;
import nu.xom.Document;
import nu.xom.ParsingException;
import nu.xom.ValidityException;
import nu.xom.xinclude.BadParseAttributeException;
import nu.xom.xinclude.InclusionLoopException;
import nu.xom.xinclude.NoIncludeLocationException;
import nu.xom.xinclude.XIncludeException;
import nu.xom.xinclude.XIncluder;

public class XIncludeXOMTest {

     public static void main( String[] args ) throws 
BadParseAttributeException, InclusionLoopException, 
NoIncludeLocationException, UnsupportedEncodingException, IOException, 
ParsingException, XIncludeException {
         Builder b = new Builder();
         Document d = b.build( "file:///path/to/xi2-in.xml" );
         System.out.println(XIncluder.resolve( d ).toXML());



              (. .)
|      Philippe Poulard       |
        Have the RefleX !
<?xml version="1.0" encoding="iso-8859-1"?>
<root xmlns:xi="http://www.w3.org/2001/XInclude";>
    <p>Include a part of A that include B that include another part of A</p>
    <A><xi:include href="xi2-A-include.xml" parse="xml" xpointer="element(/1/3)"/></A>
<?xml version="1.0" encoding="iso-8859-1"?>
<rootA xmlns:xi="http://www.w3.org/2001/XInclude";>
    <here>here<B><xi:include href="xi2-B-include.xml" parse="xml" xpointer="element(/1/1)"/></B></here>
<?xml version="1.0" encoding="iso-8859-1"?>
<rootB xmlns:xi="http://www.w3.org/2001/XInclude";>
    <somewhere>somewhere<A><xi:include href="xi2-A-include.xml" parse="xml" xpointer="element(/1/2)"/></A></somewhere>

[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