for XML File parsing I am using JAXB but after compilation following error is reported
javax.xml.bind.JAXBException: No package name is given
at javax.xml.bind.ContextFinder.find(Unknown Source)
at javax.xml.bind.JAXBContext.newInstance(Unknown Source)
at javax.xml.bind.JAXBContext.newInstance(Unknown Source)
at javax.xml.bind.JAXBContext.newInstance(Unknown Source)
at searchAlgo.Question.<init>(Question.java:16)
code is given below
import java.io.File;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Unmarshaller;
public class Question {
//String question = new String() ;
String s = new String();
Question()
{
try{
File file = new File("C:\\Users\\Username\\Documents\\levels.xml");
JAXBContext jaxbContext = JAXBContext.newInstance(s);
Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller();
String string = (String) jaxbUnmarshaller.unmarshal(file);
System.out.println(string);
}
catch(JAXBException e){
e.printStackTrace();
}
}}
do I need to install JAXB plug-in? i am using jdk 1.8.0_91 and eclipse mars