Two Laptop Bag
The moose likes XML and Related Technologies and the fly likes New to XML, need help Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Reply Bookmark "New to XML, need help" Watch "New to XML, need help" New topic
Author

New to XML, need help

Kajol Singh
Greenhorn

Joined: Oct 11, 2001
Posts: 1
Hi,
I have just started reading about XML.
I tried to run a small example on IBM'S VAJ, using DOM parser.
For some reason it does'nt work:
Here is the code:
public static void main(String[] args){
DOMParser parser = new DOMParser();
String filename = "C:/xexample.xml";
try{
parser.parse(filename);
Document doc = parser.getDocument();
} catch(Exception e)
{
System.out.println("Error in parsing" + e.getMessage());
}

}
I have classpath set and included the directory c:/ in the class path.
Could someone tell me what is wrong with this code???
Thanks,
Kaj.
L Goundalkar
Ranch Hand

Joined: Jul 05, 2001
Posts: 395
Hi,
Club the the following lines to one line of code.
try{
parser.parse(filename);
Document doc = parser.getDocument();
}
to
try{
Document doc = parser.parse(filename);
}
Thanks.
------------------
L Goundalkar
lggoundalkar@hotmail.com
Sun Certified Programmer for Java 2 Platform


<b>L G Goundalkar</b><br /> <a href="mailto:lggoundalkar@yahoo.com" rel="nofollow">lggoundalkar@yahoo.com</a> <br />Sun Certified Programmer for Java 2 Platform.<br />Sun Certified Web Component Developer for J2EE.
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: New to XML, need help
 
Similar Threads
Load xml string into DOM ?
Load xml as String into DOMParser
Validate XML against XSD using the Xerces DOM Parser
reading the xml files thru java
MalformedURLException