if you call application.getRealPath("/") to get the path to 
the application's root directory, then you can place the xml 
file whereever in that directory structure that you like.
Something like this:

<%
StringBuffer sPath = new StringBuffer();
sPath.append(application.getRealPath("/"));
sPath.append("\\xml\\myxmlfile.xml");
parser.parse ( sPath.toString() );
%>

it should work.  NOTE: you will want to make a call to find
out what the file path delimiter is rather than using the 
literal "\\".  I just don't remember what the call is to
get it...

Mark

-----Original Message-----
From: Pascal Troxler [mailto:[EMAIL PROTECTED]]
Sent: Thursday, November 30, 2000 3:23 AM
To: JRun-Talk
Subject: Re: file path



>How are you accessing the XML file?
>Are you using ClassLoader.getResourceAsStream( "filename" )?
>Need some more information before I can give you a hand.
>Adam


The code is like this:


import org.xml.sax.*;
import org.w3c.dom.*;
import org.apache.xerces.parsers.DOMParser;
....

public void parse ( ) {

     DOMParser parser = new  DOMParser();

     try {
 
parser.setFeature("http://apache.org/xml/features/dom/defer-node-expansion",

false);
 
parser.setFeature("http://apache.org/xml/features/continue-after-fatal-error
", 
true);
 
parser.setFeature("http://apache.org/xml/features/allow-java-encodings", 
true);

         parser.parse ( "myxmlfile.xml" );
         Document document = parser.getDocument();
         NodeList list = document.getChildNodes();
         .....
     } catch (Exception e) {
        ....
     }

*******

The Object "document" always gets NULL. So it seems he could not find the
file.
The Parser Object accepts a String or an InputSource Object as Parameter.
The InputSource constructor accepts a String or an InputStream.

Where is the jrun VM searching for the "myxmlfile.xml" ?


>Pascal Troxler
>University of Applied Sciences
>Biel, Switzerland



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Your ad could be here. Monies from ads go to support these lists and provide
more resources for the community. http://www.fusionauthority.com/ads.cfm

Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Your ad could be here. Monies from ads go to support these lists and provide
more resources for the community. http://www.fusionauthority.com/ads.cfm

Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. http://www.fusionauthority.com/ads.cfm

Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to