You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by "Md. Rezaul Hoque" <ja...@gmail.com> on 2004/11/13 16:17:18 UTC

Deigester.parse(File f) method

Hello,

I m facing problem with Digester.parse() method. Within console
application...it's working fine...but i am using it within tomcat it's
throwing SAXException...........

Can anybody can give any suggestion.....

I am waiting for reply....

Thanks in advance...


Babu

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Re: Deigester.parse(File f) method

Posted by Craig McClanahan <cr...@gmail.com>.
Without seeing the exception message and the stack trace, it is almost
impossible for anyone to offer you much assistance.

If you're using the parse(File) method, one thing to ensure is that
you are calculating the path of the file you are trying to parse
correctly.  If it is a resource inside your webapp, you will need to
calculate that path based on the document root of your webapp:

  ServletContext context = ...;
  String path = context.getRealPath() + "/WEB-INF/web.xml";
  File file = new File(path);
  digester.parse(file);

However, this only works when getRealPath() actually returns something
-- it is not required to do so if the container is not running the app
straight out of a directory.  A better way to reference resource files
inside the webapp is like this:

  ServletContext context = ...;
  InputStream stream = context.getResourceAsStream("/WEB-INF/web.xml");
  digester.parse(stream);

Craig



On Sat, 13 Nov 2004 21:17:18 +0600, Md. Rezaul Hoque
<ja...@gmail.com> wrote:
> Hello,
> 
> I m facing problem with Digester.parse() method. Within console
> application...it's working fine...but i am using it within tomcat it's
> throwing SAXException...........
> 
> Can anybody can give any suggestion.....
> 
> I am waiting for reply....
> 
> Thanks in advance...
> 
> Babu
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
> 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org