cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joerg Heinicke <>
Subject Re: Including Fragments
Date Wed, 14 Apr 2004 17:19:54 GMT
On 14.04.2004 18:08, Garrick Dasbach wrote:

> Hi,
> We are currently migrating our website from a pure JSP environment to 
> Cocoon and have run into a problem.

Welcome in the world of XML.

> The majority of our webpages have a header and footer, both of which are 
> fragments of xhtml documents, that we would like to include on each 
> page.  We have tried using the CInclude transformer to include these 
> elements, but cocoon seems to be upset that the files are not well 
> formed (see error message below).
> /
> org.apache.cocoon.ProcessingException: Failed to execute pipeline.: 
> file:/static/headerTest.html:6:1:org.xml.sax.SAXParseException: XML 
> document structures must start and end within the same entity.
> /We have also tried the XInclude transformer without success.  Is there 
> a way to include fragments of XHTML/XML documents in larger documents to 
> create one well-formed document?

*Ouch* No, hopefully not :) Seriously, you must switch to thinking in 
XML. The code below is really bad an error prone (even if it would 
work). What happens if you change something in headerTest.html, but not 
in footerTest.html?

For XML it should more look like:


<html xmlns:c="">
           <c:include src="static/headerTest.html"/>
           <b>The Body</b>
           <c:include src="static/footerTest.html"/>

This approach should also be flexible enough as header and footer can 
consist of nearly arbitrary HTML.


> I have included some sample code below.
> ------------------------------------------------------------------------
> *file:/static/test.html*
> /<html xmlns:c="">
>   <c:include src="static/headerTest.html"/>
>   <b>The Body</b>
>   <c:include src="static/footerTest.html"/>
> </html>/
> *file:/static/headerTest.html*
> /<body>
>  <table>
>     <tr>
>        <td>
> /*file:/static/footerTest.html*
> /         </td>
>      </tr>
>   </table>
> </body>/
> -------------------------------------------------------------------------
> Any help would be greatly appreciated.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message