cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Yasir Khalil Al Masri" <yalma...@next.jo>
Subject Re: Calling an XML file from an XSP page
Date Mon, 23 Jul 2001 14:03:11 GMT
Thanx dims.

Actually I have to questions:
1.Am I supposed to place the "votes.xml" in somewhere specific? I'm 
asking this because when I tried the code you gave me I got a 
NullPointerException thrown in method XSPUtil.relativeFilename(...), 
which indicates to me that this method is unable to find or read the 
file "votes.xml", although I made sure to place this file wherever I 
think it's feasible.
2.I didn't really know what is the objectModel Map object for, but 
nevertheless I replaced it with "this.objectModel". Was that a wrong 
thing to do?

Thank you again


----- Original Message -----
From: Davanum Srinivas <dims@yahoo.com>
Date: Monday, July 23, 2001 3:23 pm
Subject: Re: Calling an XML file from an XSP page

> 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 <yalmasri@next.jo> 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. <" 
> target="l">http://xml.apache.org/cocoon/faqs.html>> 
> > To unsubscribe, e-mail: <cocoon-users-unsubscribe@xml.apache.org>
> > For additional commands, e-mail: <cocoon-users-help@xml.apache.org>
> > 
> 
> 
> =====
> 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! 
> Messengerhttp://phonecard.yahoo.com/
> 
> -------------------------------------------------------------------
> --
> Please check that your question has not already been answered in the
> FAQ before posting. <" 
> target="l">http://xml.apache.org/cocoon/faqs.html>
> To unsubscribe, e-mail: <cocoon-users-unsubscribe@xml.apache.org>
> For additional commands, e-mail: <cocoon-users-help@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: <cocoon-users-unsubscribe@xml.apache.org>
For additional commands, e-mail: <cocoon-users-help@xml.apache.org>


Mime
View raw message