Try this. See util.xsl and XSPUtil.java for the sources.

Thanks,
dims

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



--- Yasir Khalil Al Masri <[EMAIL PROTECTED]> 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: <[EMAIL PROTECTED]>
> For additional commands, e-mail: <[EMAIL PROTECTED]>
> 


=====
Davanum Srinivas, JNI-FAQ Manager
http://www.jGuru.com/faq/JNI

__________________________________________________
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/

---------------------------------------------------------------------
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: <[EMAIL PROTECTED]>
For additional commands, e-mail: <[EMAIL PROTECTED]>

Reply via email to