Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link

Vijay Verma

Greenhorn
+ Follow
since Oct 21, 2005
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Vijay Verma

no becuase Document object is null.
yes same xml file i can read with java program..
and i tried with many xml files but no use..

actually when i say factory.setValidating(true);

it gives some errors like Grammer not found etc.
[ October 21, 2005: Message edited by: Vijay Verma ]
Yes I can read files using java.io
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();
}
}
}
In which section should I ask question about XML parsing or XML stuff?
16 years ago