1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
|
// Lecture du fchier modele
Document docXml = XML.ReadXMLFile(sFicTemplateXml);
Element udElt = docXml.getDocumentElement();
udElt.setAttribute("s", XML.GetAttribute(monDocumentSource.getDocumentElement(), AT_SK));
udElt.setAttribute("re", XML.GetAttribute(monDocumentSource.getDocumentElement(), ATT_NM));
// Mise à jour de la reference au fichier Jpg
Element imgElt = XML.getFirstChildElement(udElt, "IMG");
String[] splitFile = sJpegFilename.split("\\\\");
imgElt.setAttribute("file", splitFile[splitFile.length-1]);
// On compte le nombre d'applicabilités
String[] listeApp = tableDocumentParts.applicability();
//
for(int iApp=0;iApp<listeApp.length;iApp++){
Element appElt = docXml.createElement("APP");
udElt.appendChild(appElt);
appElt.setAttribute("app", listeApp[iApp]);
for(int ii=0;ii<tableDocumentParts.getItemCount();ii++){
if(listeApp[iApp].equals(tableDocumentParts.getTable().getItem(ii).getText(CardocFolder.N_APPLICABILITES)) && tableDocumentParts.hasIDvisible(ii)){
Element refElt = docXml.createElement("ELEMENT");
appElt.appendChild(refElt);
refElt.setAttribute("id", tableDocumentParts.getTable().getItem(ii).getText(CardocFolder.N_ID));
String designation=tableDocumentParts.getTable().getItem(ii).getText(CardocFolder.N_DESIGNATION);
refElt.setAttribute("designation", tableDocumentParts.getTable().getItem(ii).getText(CardocFolder.N_DESIGNATION));
String commentaire = tableDocumentParts.getTable().getItem(ii).getText(CardocFolder.N_COMMENTAIRE);
if(tableDocumentParts.getTable().getItem(ii).getText(CardocFolder.N_REF_OS).length()>0) commentaire += " ( " +tableDocumentParts.getTable().getItem(ii).getText(CardocFolder.N_REF_OS)+" )";
refElt.setAttribute("commentaire", commentaire);
}
}
}
XML.saveXMLFile(docXml, sXmlFileName); |