Or Continue to Thread: [Q] java and xml
Find Your Device:
16th March 2014, 02:03 PM   |  #1  
OP Junior Member
Thanks Meter: 0
 
1 posts
Join Date:Joined: Mar 2014
something is wrong with my setup...

Eclipse Keplar
Windows 7 32bit
java 7u51

db = dbf.newDocumentBuilder(); throws ParserConfigurationError..
please help me. this file is as simple as i could make it.


import java.io.File;
import java.io.IOException;

import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;

import org.w3c.dom.Document;
import org.xml.sax.SAXException;


public class XMLHELP {

public static void main(String[] args) {

File file = new File("foo.xml");
DocumentBuilderFactory dbf;
DocumentBuilder db = null;

dbf = DocumentBuilderFactory.newInstance();
try {
db = dbf.newDocumentBuilder();
} catch (ParserConfigurationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

try {
Document doc = db.parse(file);
} catch (SAXException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

}

}