Page 1 of 1

Mutual, non-recursive xinclusion

Posted: Fri Apr 27, 2018 1:34 am
by dcramer
As I understand the xinclude spec, it's legal to xinclude for document's to xinclude from each other as long as they don't loop:
https://www.w3.org/TR/xinclude/#loops

When I process either of the following documents with Calabash, it handles them just fine. However, if I try to validate either in Oxygen, I get a stack overflow error: "A stack overflow error occurred. You have to increase the stack size by setting the -Xss parameter to the Java virtual machine in the <oXygen/> startup script, for example -Xss512k. See the section "Setting a parameter in the startup script" of the User Manual."

a.xml

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<book xmlns="http://docbook.org/ns/docbook"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:xi="http://www.w3.org/2001/XInclude"
xml:id="a-book"
version="5.0">
<title>A</title>
<chapter xml:id="a-chapter">
<title>a chapter</title>
<para>foo</para>
</chapter>
<xi:include href="b.xml" xpointer="b-chapter"/>
</book>
b.xml

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<book xmlns="http://docbook.org/ns/docbook"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:xi="http://www.w3.org/2001/XInclude"
xml:id="b-book"
version="5.0">
<title>B</title>
<chapter xml:id="b-chapter">
<title>b chapter</title>
<para>foo</para>
</chapter>
<xi:include href="a.xml" xpointer="a-chapter"/>
</book>

Re: Mutual, non-recursive xinclusion

Posted: Fri Apr 27, 2018 3:03 pm
by adrian
Hi,

I can confirm the issue. I have logged it to our issue tracking tool. For future reference it is issue EXM-41495.
We will notify this thread when it is resolved.

Regards,
Adrian

Re: Mutual, non-recursive xinclusion

Posted: Mon Apr 30, 2018 2:00 pm
by Radu
Hi David,

As a small remark, Oxygen uses the Xerces parser to validate the XML documents and I can reproduce the same problem using a Xerces library outside of Oxygen. But we'll see what we can do, if we find a possible fix maybe we can try to create a patch for this in our code.
I'm not sure why this works for you in Calabash, probably because you disabled XI:include processing and are using XSLT to resolve xi:includes which have xpointer.

Regards,
Radu

Re: Mutual, non-recursive xinclusion

Posted: Mon Apr 30, 2018 3:54 pm
by dcramer
Actually, it works for me using p:xinclude to resolve the xi:includes:

Code: Select all


dcramer@MacBook-Pro ~/Desktop/xinclude-recursion-test
$ cat xinclude.xpl
<?xml version="1.0" encoding="UTF-8"?>
<p:declare-step xmlns:p="http://www.w3.org/ns/xproc" xmlns:c="http://www.w3.org/ns/xproc-step"
version="1.0" name="main">
<p:input port="source"/>
<p:output port="result">
<p:pipe port="result" step="xinclude"/>
</p:output>

<p:xinclude fixup-xml-base="true" name="xinclude"/>

</p:declare-step>

dcramer@MacBook-Pro ~/Desktop/xinclude-recursion-test
$ /Applications/xmlcalabash-1.1.20-98/calabash -i a.xml xinclude.xpl
<book xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude" xml:id="a-book" version="5.0">
<title>A</title>
<chapter xml:id="a-chapter">
<title>a chapter</title>
<para>foo</para>
</chapter>
<chapter xml:id="b-chapter" xml:base="file:/Users/dcramer/Desktop/xinclude-recursion-test/b.xml">
<title>b chapter</title>
<para>foo</para>
</chapter>
</book>

Re: Mutual, non-recursive xinclusion

Posted: Wed May 02, 2018 8:49 am
by Radu
Hi,

From what I looked Norman Walsh's "com.xmlcalabash.library.XInclude" Java implementation is not based on using Xerces to resolve the xi:include so probably this is why it does not have the same problems.

Regards,
Radu

Re: Mutual, non-recursive xinclusion

Posted: Fri May 04, 2018 5:57 pm
by dcramer
Update: Just spent some time with a group of users who were having performance problems with Oxygen where it was spiking their CPU. It turned out to be this issue again.

Is switching to Norm's implementation an option? Though then we'd want to pester him to fix https://github.com/ndw/xmlcalabash1/issues/273:


David

Re: Mutual, non-recursive xinclusion

Posted: Mon May 07, 2018 10:43 am
by Radu
Hi David,

Switching to another implementation for validation/visual editing is not an option.
I will try to dig some more, see if we can come up with a fix.
But somehow I would have expected that using xi:include from one file to another and that other file having xi:includes to the first one is not a very well thought out reuse strategy. For example you could create a Docbook file containing only reusable content (for example those two chapters) and then reuse with xi:include those two chapters from the actual Docbook modules.


Regards,
Radu

Re: Mutual, non-recursive xinclusion

Posted: Mon May 07, 2018 5:32 pm
by dcramer
We do encourage authors to split out reusable pieces, but opportunistic sharing still happens. From the author's point of view, it's much more convenient to insert an xi:include, use the file chooser to pick the book file, and use the nifty picker to find the section they want than it is to worry about what source file the content they want is in.

In the long run, I plan to move to a system where they're pulling in content from published artifacts instead of other source files. That will also avoid this situation. In the near term though, it's hard to explain when they do something that's technically legal, but Oxygen consumes all available CPU until they force quit :-)

Regards,
David

Re: Mutual, non-recursive xinclusion

Posted: Tue May 08, 2018 8:30 am
by Radu
Hi David,

I understand. I added a fix for this yesterday in our code, our automated tests look OK. If you want to test this on your side (your test samples being more complex) you can contact us via email (support@oxygenxml.com) and if you tell me your operating system I could try to build a beta Oxygen 20.1 kit for you to test. We plan to release Oxygen 20.1 probably in June-July this year.

Regards,
Radu

Re: Mutual, non-recursive xinclusion

Posted: Tue May 08, 2018 3:33 pm
by dcramer
Thanks for finding a fix so quickly. I've sent my information. Our users do indeed have some complex documents to test it against.

Regards,
David

Re: Mutual, non-recursive xinclusion

Posted: Mon Jun 18, 2018 3:40 pm
by Radu
Hi David,

We released Oxygen 20.1 which should have a fix for this problem you reported above.

Regards,
Radu

Re: Mutual, non-recursive xinclusion

Posted: Tue Jun 19, 2018 6:24 pm
by dcramer
Thanks!