Ciao ragazzi, ho un problema con la creazione di un file Xml :
Ho una lista di oggetti e tramite un generatore di file xml ( Xml Generator ) devo creare dei file Xml di output.
il problema è che l'xml di output mi da errore e si ferma al primo oggetto. vi allego di seguito il codice java, il template xml, e l'output.
Grazie per l'aiuto
CODICE JAVA
Template XMLcodice:public void createList(String objectId) throws Exception{ app.selectByObjectId(objectId); Map gcData = new HashMap(); gcData.put("Id", objectId); gcData.put("Name", ""); gcData.put("type",""); List imageList = new ArrayList<HashMap>(); Map imageInfo = new HashMap<String, String>(); imageInfo = new HashMap(); for (Image img : image) { imageInfo = new HashMap(); imageInfo.put("imageId", img.getId()); imageInfo.put("userId", img.getUserId()); if (img.getName() == null) { imageInfo.put("name", ""); } else { imageInfo.put("name", img.getName()); } imageInfo.put("date", img.getDate()); imageList.add(imageInfo); gcData.put("imageInfo", imageList); freemarkerDo(gcData, "Result.ftl"); } }
codice:<?xml version="1.0" ?> <DESCRIPTION>Image Informations</DESCRIPTION> <PARAM name='Id' value="${Id}" datatype="char"> </PARAM> <TABLE ID='Images' name='images about the cluster'> <FIELD name='imageId' datatype='int'/> <FIELD name='userId' datatype='char'/> <FIELD name='name' datatype='char'/> <FIELD name='date' datatype='char'/> <DATA> <TABLEDATA> <#list imageInfo as img> <TR> <TD>${img.imageId}</TD> <TD>${img.userId}</TD> <TD>${img.name}</TD> <TD>${img.date}</TD> </TR> </#list> </TABLEDATA> </DATA> </TABLE>

Rispondi quotando
