Hello, I have a list of Notes objects and need to save them in xml files. I'm trying to convert this list to arrays to add them to the xml file. However I am not able to do the conversion properly, because it is a list of Notes that receive another list of Products. What is the best solution?
List<Notas> listaNotas;
Notas[] arrayListaNotas;
for(int i=0; i<listaNotas.size();i++) {
arrayListaNotas =
listaNotas.get(i).getProdutos().toArray(new
Notas[listaNotas.get(i).getProdutos().size()]);
listaInsercaoXml[i] =arrayListaNotas;// Aqui acontece o erro na hora de tentar atribuir
}
int qtdeNotasXml=5;
for(int i=0; i<listaInsercaoXml.length;i++) {
stringXml = xstream.toXML(Arrays.copyOfRange(listaInsercaoXml, i, Math.min(listaInsercaoXml.length, i+qtdeNotasXml)));
file = new PrintWriter(new BufferedWriter(new FileWriter("C:\notas"+i+".xml")));
file.println(stringXml);
file.close();
}