Ryuji Yokoyama wrote:
> Hello All! > > I want to use Xerces 1.4 with Servlet. If I try to create a parser as > following by Servlet, DOMParser doesn't find the xml file. I am running > Servlet locally using TOMCAT 3.2. This code works if I don't use > Servlet, so I thought I had to specify the location of file differently. > Therefore, I also tried "http://localhost/servlet/test.xml" and > "localhost/servlet/test.xml". Of course, I put test.xml file into > servlet directory. However, it didn't work. > > Could anybody tell me how to fix the problem? > > Thanks in advance. > > DOMParser parser = new DOMParser(); > try{ > parser.parse("E:\\java\\test.xml"); > doc = parser.getDocument(); > } catch(SAXException e2){e2.printStackTrace();} > catch(IOException e1){e1.printStackTrace();} Try the following: DOMParser parser = new DOMParser(); try{ parser.parse("E:/java/test.xml"); doc = parser.getDocument(); } catch(SAXException e2){e2.printStackTrace();} catch(IOException e1){e1.printStackTrace();} Regards Darius