aspose file tools*
The moose likes XML and Related Technologies and the fly likes New to XML, need help 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 "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.
 
 
subject: New to XML, need help
 
Similar Threads
Load xml as String into DOMParser
MalformedURLException
reading the xml files thru java
Validate XML against XSD using the Xerces DOM Parser
Load xml string into DOM ?