I've been able to do it like this:

        URL url = getServletContext().getResource("/blah.xml");
      URLConnection conn = (URLConnection) url.openConnection();
      InputStream in = conn.getInputStream();
      DocumentBuilderFactory dfactory =
DocumentBuilderFactory.newInstance();
      doc = dfactory.newDocumentBuilder().parse(in);
      in.close();

-Tim


-----Original Message-----
From: Susmita Pati [mailto:[EMAIL PROTECTED]]
Sent: Thursday, December 12, 2002 2:34 PM
To: 'Struts Users Mailing List'
Subject: Tomcat Tries to look For the specified file in the Bin
Directory


Hi Folks

Am not able to Retrieve the XML file that i have in my conf directory.
If i just give the location as {String location = "logonconfig.xml"; } It
points to the 
Apache Tomcat 4.0 /bin directory.If i give the location as {String location
= "..\\webapps\\Dynapro4.3\\web-inf\\conf\\logonconfig.xml";}  Then it
points to the Apache Tomcat 4.0
/bin/webapps/Dynapro4.3/web-inf/conf/logonconfig.xml"


Here is the code where in i am trying to pick up the xml file.


  Element root = null;
            try {
                        Document doc = null;
                        String location = "logonconfig.xml";
                        //String location =
"..\\webapps\\Dynapro4.3\\web-inf\\conf\\logonconfig.xml";
                DocumentBuilderFactory docBuilderFactory =
DocumentBuilderFactory.newInstance();
                DocumentBuilder parser =
docBuilderFactory.newDocumentBuilder();

                        doc = parser.parse(new File(location));
                root = doc.getDocumentElement();
 
            }


Thanks in Advance
Susmita

--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>




--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to