You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by SoftLiban ITANI Mohamed <mo...@softsolutions.fr> on 2001/08/06 11:02:42 UTC

Re: Calling an XML file from an XSP page

Hello Cocooners,

I want to call an xml resulted of a jsp page and embed its content into my
xsp page.

Here u suggested something like :

InputSource is = new InputSource(
                      new FileReader(
                         XSPUtil.relativeFilename(
                           "file.xml",
                           objectModel
                        )
                      )
                  );

Could I call a jsp file instead of file.xml and pass it some parameters??

Itani

Yasir Khalil Al Masri wrote:

> Hello,
>
> I'm tring in one of the XSP pages to call an XML file that resides on
> my machine.  It came to me that as you can call an image by mapping it
> through:
> <map:match pattern="images/**.png">
>    <map:read src="project/images/{1}.png" mime-type="image/png"/>
> </map:match>
>
> you can do the same for the XML files:
> <map:match pattern="**.xml">
>    <map:read src="project/XMLfiles/{1}.xml" mime-type="text/xml"/>
> </map:match>
>
> Now in one of the XSP files, I'm doing this:
> InputSource input = new InputSource( new FileInputStream(
>                   "votes.xml" ) );
> where votes.xml is in the XMLfiles directory.  I suppose that mapping
> like this is clear enough to tell the cocoon engine where to find this
> file, but whenever I execute this code I got a large stack dumped to
> the server monitor saying that it cannot find the file mentioned.  I
> tried to put it in many shapes like:
> InputSource input = new InputSource( new FileInputStream(
>                   "cocoon:/XMLfiles/votes.xml" ) );
>
> Even I tried to call it directly from the current working directory, or
> from the root of the project without mapping, I always got the same
> result.
>
> I succeeded only when I hardcoded the full path of the file starting
> from the current drive, which I don't think it's a professional way to
> do this.
>
> Do anybody have comment on this?
>
> Thanx.
>
> ---------------------------------------------------------------------
> Please check that your question has not already been answered in the
> FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
>
> To unsubscribe, e-mail: <co...@xml.apache.org>
> For additional commands, e-mail: <co...@xml.apache.org>


---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>