jaxb.index file but i don´t know if it´s a good way to me.
I have a structure of classes and packages thats represent the tree of xml that i want to extract his date.
So i want to know what´s the best way, because i´m getting nullPointerException
when i´m trying to acess a field.
So what can i do?
My root class is NFeProc
.
My main class
public class Teste {
public static void main(String[] args) {
try {
JAXBContext jaxbContext = JAXBContext.newInstance(new Class[] { nfeProc.NFeProc.class });
Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
NFeProc nFeProc = (NFeProc) unmarshaller.unmarshal(new File("nfe.xml"));
nFeProc.getNfe().getInfNFe().getEmitente().getCnpj();
} catch (JAXBException e) {
e.printStackTrace();
}
}
}