File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes XML and Related Technologies and the fly likes parsing prob Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "parsing prob" Watch "parsing prob" New topic

parsing prob

andy yeo

Joined: Jul 26, 2001
Posts: 3
I tried with the below to parse in a existing xml document in a jsp page.
String getFileName;// dir of xml file
getFileName = request.getParameter("selected");
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
Document node = builder.parse(new File(getFileName));
When I try to load the page, the following error was displayed.
Class jsp_servlet._fypj._supplier._receivepip.Document not found.
It seems that the xml document is not found. Can someone tell me wat was the error here. thx.
rani bedi
Ranch Hand

Joined: Feb 06, 2001
Posts: 358
The parse method for the DocumentBuilder class should be passed filename as a parameter. Instead of passing filename you have passed the directory name.
Check the Java API for XML Parsing 1.1.1
parse( f)
Parse the content of the given file as an XML document and return a new DOM Document object.

Cheers,<br />Rani<br />SCJP, SCWCD, SCBCD
rani bedi
Ranch Hand

Joined: Feb 06, 2001
Posts: 358
Did you check it out?
I agree. Here's the link:
subject: parsing prob
It's not a secret anymore!