Yasir,

See below.

--- Yasir Khalil Al Masri <[EMAIL PROTECTED]> wrote:
> 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.

If you place the votes.xml in webapp/docs/samples/xsp, then use 
docs/samples/xsp/votes.xml to load
it.

> 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?

Yes. 

> Thank you again
> 
> 
> ----- Original Message -----
> From: Davanum Srinivas <[EMAIL PROTECTED]>
> 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 <[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. <" 
> > target="l">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! 
> > 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: <[EMAIL PROTECTED]>
> > For additional commands, e-mail: <[EMAIL PROTECTED]>
> > 
> > 
> 
> 
> ---------------------------------------------------------------------
> 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