• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

New to XML, need help

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 395
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
reply
    Bookmark Topic Watch Topic
  • New Topic