Can't run very simple DOM parsing source on my machine - please help :(

Hi Guys,
I am trying to run the following very simple program on my machine to parse a very simple XML file.
It just returns Document object NULL.
Same code is working fine on another machine.
Note: there is no silly mistake. i have valid xml file at valid place.
Please help.
import org.apache.xerces.parsers.*;
import org.w3c.dom.*;
import org.xml.sax.*;
import java.io.*;
class XML
     public static void main(String[] args)
          try{
               String caseFile = "c:\\case-config\\config.xml";
               DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
               factory.setValidating(true);
               DocumentBuilder builder = factory.newDocumentBuilder();
               Document doc = builder.parse(caseFile);
               System.out.println("\n\n----" + doc);
          }catch(Exception e)
               e.printStackTrace();
}

You could also work with JDOM, which I find easier to use than regular DOM:
import org.xml.sax.InputSource;
import java.io.FileReader;
import org.jdom.input.SAXBuilder;
import org.jdom.Document;
String caseFile = "c:/case-config/config.xml";
InputSource inputSource = new InputSource(new FileReader(caseFile));
SAXBuilder builder= new SAXBuilder();
Document document = builder.build(inputSource);Just an alternate suggestion.

Similar Messages

Maybe you are looking for

  • How can i print out the waveform chart?

      hello everybody, how can i print out the "waveform chart". can i do it just push the button. ( example; stop button is stop the program etc..) i checked the NI examples but i can't understand. i'm new to the Labview. pls help me. i added the my pro

  • 17" MacBook Pro to 30" HD Display issue using Mini DisplayPort to Dual-Link DVI Adaptor.

    Just replaced the Western Digital hard drive on my MacBook Pro with a SSD now running Lion 10.8.2, (updating from Snow Leopard latest version). I have a 30" HD Apple display monitor and very much love using it. The issue. The MacBook Pro will only al

  • What happened to the app called "APPLETS"?

    So I am trying to find this app on the app store, but it doesn't show up... Did they replace it or something ? Please help me.. I had important info there and It seems like I lost it..

  • Ant - Create Connection Pool on WebLogic 10.1.3

    Hi, I have created the following build.xml file to create a Datasource on weblogic using ANT . The file is as follows: <?xml version="1.0" encoding="windows-1252" ?> <project name="deploy" default="all" basedir=".">   <property file="build.properties

  • Why is my named anchor link not working

    Can someone please help. I am a novice at Dreamweaver - but my website works well with almost all links working. Situation : The problem lies on the following page  www.ozonesystems.co.uk/airunits There are 7 links in the table which point to Named A