Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

DOM Implementation

import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.DocumentBuilder;
import org.w3c.dom.*;
import javax.xml.parsers.*;

public class ShowDomImpl {

public static void main(String args[]){

Document doc = null;
String FilePath = "";
try{

DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder docb = dbf.newDocumentBuilder();
FilePath = args[0];
doc = docb.parse(FilePath);
}
catch(Exception e){
System.out.println("Problem parsing the file."+e);
System.exit(1);
}
}
}

When I tried the above example I 'm getting the follwing exception.
Problem parsing the file..

Can anyone help on this at the earliest?
[773 byte] By [Subramani] at [2007-11-9 15:27:32]
# 1 Re: DOM Implementation
What is the exception's message?

"Subramani" <vbsubramani@yahoo.com> wrote:
>
>import javax.xml.parsers.DocumentBuilderFactory;
>import javax.xml.parsers.DocumentBuilder;
>import org.w3c.dom.*;
>import javax.xml.parsers.*;
>
>
>
>public class ShowDomImpl {
>
> public static void main(String args[]){
>
> Document doc = null;
> String FilePath = "";
> try{
>
> DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
> DocumentBuilder docb = dbf.newDocumentBuilder();
> FilePath = args[0];
> doc = docb.parse(FilePath);
> }
> catch(Exception e){
> System.out.println("Problem parsing the file."+e);
> System.exit(1);
> }
> }
>}
>
>When I tried the above example I 'm getting the follwing exception.
>Problem parsing the file..
>
>Can anyone help on this at the earliest?
>
>
Mark at 2007-11-11 23:29:52 >