Salve a tutti, per un apllicazione ho necessita di generare un report in pdf, partendo da un array, generando un file xml e poi convertendolo.
Per generare il file sto usando jdom. Con rad importo il jar esterno scaricato dal sito ufficiale versione 1.0, fin qui tutto ok. al momento di eseguire il tutto mi restituisce sul browser questo:
questo e' il codice della classe che uso per creare il file xml.codice:Error 500: org.jdom.Content
In debug ho visto che ottengo l'errore nel momento in cui istanzio l'oggetto nella servlet, con codice:codice:import java.io.*; import java.util.*; import org.jdom.Document; import org.jdom.Element; import org.jdom.ProcessingInstruction; import org.jdom.output.Format; import org.jdom.output.XMLOutputter; public class XmlObject { public XmlObject(Azienda azienda, String path){ makeXml(azienda, path); } public void makeXml(Azienda azienda, String path){ //generazione file xml File fileTmp = new File(path+"temp4pdf.xml"); Element root = new Element("root"); /* Map<String, String> mapping = new HashMap<String, String>(); mapping.put("type", "text/xsl"); mapping.put("href", path+"template/fop.xsl"); ProcessingInstruction pi = new ProcessingInstruction("xml-stylesheet", mapping); */ Element a = new Element("azienda"); a.setText(azienda.getRagioneSociale()); a.setAttribute("codice", Integer.toString(azienda.getCodice())); a.setAttribute("annoesercizio", Integer.toString(azienda.getAnnoEsercizio())); a.setAttribute("ragionesociale", azienda.getRagioneSociale()); a.setAttribute("dataultimamodifica", azienda.getDataUltimaModifica().toString()); a.setAttribute("utentemodifica", Integer.toString(azienda.getUtenteModifica())); a.setAttribute("nomedb", azienda.getNomeDb()); root.addContent(a); Document documento = new Document(); documento.setRootElement(root); BufferedWriter out = null; try{ out = new BufferedWriter(new FileWriter(fileTmp)); XMLOutputter xout = new XMLOutputter(); xout.setFormat(Format.getPrettyFormat()); xout.output(documento, out); }catch(IOException e){ //errore }finally{ try { out.close(); }catch (IOException e){ //errore } } } }
Qualcuno riesce a capire dove diamine sbaglio?codice:[...] XmlObject xml = new XmlObject(azienda, path); [...]![]()
![]()

Rispondi quotando
