You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Janet Yvan <Yj...@dsmdir.cea.fr> on 2005/07/19 11:53:17 UTC

Sitemap catching exceptions

Hi all.

 

In my webapp, I have to deal with externally generated data. These data are
not every time valid XML, so I need to catch parsing exceptions and then to
continue generating my page. So I designed a special pipeline which was
meant to handle parse errors. When I directly call the pipeline, the errors
are caught and an empty page is generated. But when I try to load the whole
page, it sends me a parse error … I don’t understand why …

 

Thanks in advance.

Yvan

 

Here are some pieces of my sitemap :

 

<!—Pipeline which retrieves external data -->

<map:pipeline type="noncaching">

      <map:match pattern="**/annonces.drfmc">

            <map:generate
src="http://w10-drfmc.saclay.cea.fr/Phocea/Xml/Seminaires"/>

            <map:serialize type="xml"/>

      </map:match>

 

      <map:match pattern="**/annonces.ext.xml">

            <map:aggregate element="seminaires">

                  <map:part src="cocoon:/{1}/annonces.drfmc"/>

                  <map:part src="cocoon:/{1}/annonces.drecam"/>

                  <map:part src="cocoon:/{1}/annonces.dapnia"/>

            </map:aggregate>

            <map:serialize type="xml"/>

      </map:match>

 

<map:handle-errors>

                  <map:select type="exception">

                        <map:when test="document-does-not-exist">

                              <map:generate
src="../../content/util/empty.xml"/>

                        <map:serialize type="xml"/>

                  </map:when>

                  <map:otherwise>

                              <map:generate
src="../../content/util/empty.xml"/>

                        <map:serialize type="xml"/>

                  </map:otherwise>

            </map:select>

      </map:handle-errors>

</map:pipeline>

 

<map:pipeline>

<map:match pattern="**/annonces.html">

            <map:aggregate element="cmsbody" label="src">

                  <map:part src="cocoon:/{1}/mymenu.xml"/>       

                  <map:part src="cocoon:/{1}/annonces.ext.xml"/>

                  <map:part src="cocoon:/{1}/annonces.xml"/>

            </map:aggregate>

            <map:transform src="./xslt/annonce2xhtml.xsl" label="toto">

                  <map:parameter name="use-request-parameters"
value="true"/>

                  <map:parameter name="root" value="/dsm/live"/>

            </map:transform>

            <map:serialize type="xhtml"/>

      </map:match>

</map:pipeline>


Re: Sitemap catching exceptions

Posted by Jorg Heymans <jh...@domek.be>.

Janet Yvan wrote:
> Hi all.
> 
>  
> 
> In my webapp, I have to deal with externally generated data. These data
> are not every time valid XML, so I need to catch parsing exceptions and
> then to continue generating my page. So I designed a special pipeline
> which was meant to handle parse errors. When I directly call the
> pipeline, the errors are caught and an empty page is generated. But when
> I try to load the whole page, it sends me a parse error … I don’t
> understand why …
> 

Try declaring your map:handle-errors in the pipeline that handles the
aggregation.


HTH
Jorg


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org