From 14b130497fc9c8967db224af46a58c6063c6b909 Mon Sep 17 00:00:00 2001 From: "pascale.noyret" Date: Thu, 28 Nov 2019 13:50:21 +0100 Subject: [PATCH] pour les include en cascade. reste le pb de l include du milieu --- Efi2Xsd/AccasXsd.py | 69 +++++++++++++++++++------------------------ Efi2Xsd/balisesXSD.py | 9 +++--- 2 files changed, 36 insertions(+), 42 deletions(-) diff --git a/Efi2Xsd/AccasXsd.py b/Efi2Xsd/AccasXsd.py index d0ef7753..a4e92744 100755 --- a/Efi2Xsd/AccasXsd.py +++ b/Efi2Xsd/AccasXsd.py @@ -100,7 +100,7 @@ class X_definitionComposee (X_definition): fichierDejaDumpe = True return texteComplexeVenantDesFils - def dumpXsd(self, inExtension=False): + def dumpXsd(self): #print ('------------------------------------------------') if PourTraduction : print (self.nom) @@ -113,13 +113,11 @@ class X_definitionComposee (X_definition): # if self.aCreer : self.texteComplexe = debutTypeCompo.format(self.nomDuTypePyxb) - if inExtension : self.texteComplexe += debutEtension.format(self.nomDuCodeDumpe) self.texteComplexe += debutTypeCompoSeq texteComplexeVenantDesFils=self.CreeTexteComplexeVenantDesFils() self.texteComplexe = texteComplexeVenantDesFils + self.texteComplexe if not isinstance(self,X_OPER ) : self.texteComplexe += finTypeCompoSeq - if inExtension : self.texteComplexe += finExtension self.texteComplexe += finTypeCompo else : self.texteComplexe = "" @@ -159,13 +157,12 @@ class X_FACT (X_definitionComposee): # --------------------------------- class X_OPER (X_definitionComposee): # --------------------------------- - def dumpXsd(self,inExtension=False): + def dumpXsd(self): X_definitionComposee.dumpXsd(self, inExtension) self.texteComplexe += finTypeCompoSeq self.texteComplexe += operAttributeName self.texteComplexe += attributeTypeForASSD self.texteComplexe += attributeTypeUtilisateurName.format(self.sd_prod.__name__) - if inExtension : self.texteComplexe += finExtension self.texteComplexe += finTypeCompo @@ -328,55 +325,50 @@ class X_JDC_CATA : def dumpXsd(self): cata = CONTEXT.getCurrentCata() - print ('self.implement -------------------', self.implement) - print ('self.importedBy -------------------', self.importedBy) + #print ('self.implement -------------------', self.implement) + #print ('self.importedBy -------------------', self.importedBy) + #print ('self.code -------------------', self.code) self.texteSimple = "" self.texteComplexe = "" - self.texteCata = "" + self.texteCata = "" + self.texteDeclaration = "" + self.texteInclusion = "" + self.texteElt = "" - # a verifier if self.implement == "" : self.nomDuCodeDumpe=self.labelCode + self.texteCata += debutTypeCata.format(self.nomDuCodeDumpe) else : self.nomDuCodeDumpe = self.implement + self.texteCata += debutTypeCataExtension.format(self.nomDuCodeDumpe) + self.texteCata += debutExtension.format(self.code,self.nomDuCodeDumpe) + self.texteInclusion += includeCata.format(self.code) - if self.implement == "" : - self.texteCata = debutTypeCata.format(self.nomDuCodeDumpe) - self.inExtension = False - else : - self.inExtension = True - self.texteSimple += TypeEtEltAbstraitCodeSpec.format(self.nomDuCodeDumpe,self.nomDuCodeDumpe, self.nomDuCodeDumpe, self.nomDuCodeDumpe,) - self.texteCata += includeCata.format(self.nomDuCodeDumpe) - self.texteCata += EltCodeSpecDsCata.format(self.nomDuCodeDumpe) - - self.texteElt = "" self.nomDuTypePyxb = 'T_'+self.nomDuCodeDumpe - self.dumpLesCommandes() - - #for commande in self.commandes : - # commande.nomDuCodeDumpe=self.nomDuCodeDumpe - # commande.dumpXsd() - # self.texteSimple += commande.texteSimple - # self.texteSimple += commande.texteComplexe - # self.texteCata += commande.texteElt #self.texteSimple += TypeEtEltAbstraitCodeSpec.format(self.nomDuCodeDumpe) + self.texteTypeAbstrait='' for codeHeritant in self.importedBy: - self.texteCata += EltCodeSpecDsCata.format(codeHeritant) - self.texteTypeAbstrait += eltAbstrait.format(codeHeritant,codeHeritant,codeHeritant) - self.texteCata += finTypeCata + self.texteCata += EltCodeSpecDsCata.format(codeHeritant) + self.texteTypeAbstrait += eltAbstrait.format(codeHeritant,codeHeritant,codeHeritant,codeHeritant) + + if self.implement != "" : self.texteCata = self.texteCata + finExtension + finTypeCompo + else : self.texteCata += finTypeCata + self.texteElt = eltCata.format(self.nomDuCodeDumpe,self.nomDuCodeDumpe, self.nomDuTypePyxb) - self.texteXSD = texteDebut.format(self.nomDuCodeDumpe,self.nomDuCodeDumpe,self.nomDuCodeDumpe,self.nomDuCodeDumpe) - #self.texteXSD += textDeclaration + self.texteXSD = texteDebut.format(self.code,self.code,self.code,self.code) + if self.texteInclusion != "" : self.texteXSD += self.texteInclusion self.texteXSD += self.texteSimple - self.texteXSD += self.texteTypeAbstrait + self.texteXSD += self.texteComplexe + if self.texteTypeAbstrait != "" : self.texteXSD += self.texteTypeAbstrait self.texteXSD += self.texteCata self.texteXSD += self.texteElt self.texteXSD += texteFin + #if not PourTraduction : print (self.texteXSD) dico = {} for k in list(cata.dictTypesXSD.keys()): @@ -391,6 +383,7 @@ class X_JDC_CATA : #import pprint #if (not PourTraduction) and (dico != {}) : pprint.pprint(dico) + print (self.texteXSD) return self.texteXSD @@ -440,12 +433,12 @@ class X_JDC_CATA : self.texteSimple = '' - self.texteElt = '' + self.texteComplexe = '' for c in allClassToDump : if not(isinstance(c, Accas.OPER)) and not(isinstance(c, Accas.PROC)) : continue c.nomDuCodeDumpe=self.nomDuCodeDumpe - c.dumpXsd(self.inExtension) - self.texteSimple += c.texteSimple - self.texteSimple += c.texteComplexe + c.dumpXsd() + self.texteSimple += c.texteSimple + self.texteComplexe += c.texteComplexe c.texteElt=eltCompoDsSequenceInExtension.format(c.nom,self.nomDuCodeDumpe,c.nomDuTypePyxb) - self.texteCata += c.texteElt + self.texteCata += c.texteElt diff --git a/Efi2Xsd/balisesXSD.py b/Efi2Xsd/balisesXSD.py index 77e20215..0dc86a3d 100644 --- a/Efi2Xsd/balisesXSD.py +++ b/Efi2Xsd/balisesXSD.py @@ -44,19 +44,20 @@ attributeTypeUtilisateurName = '\t\t\n\t\t\n' +debutTypeCataExtension = '\t\n' finTypeCata = '\t\t\n\t\n' finSchema = '' eltCata = '\t\n' TypeEtEltAbstraitCodeSpec = '\t\n\t\n' EltCodeSpecDsCata='\t\t\t\n' -includeCata = '\t\n\n' +includeCata = '\n\n' # EXTENSION -debutEtension = '\t\t\n\t\t\n' -finExtension = '\t\t\n\t\t\n' +debutExtension = '\t\t\n\t\t\n\t\t\n' +finExtension = '\t\t\n\t\t\n\t\t\n' # TYPE ABSTRAIT -eltAbstrait = '\t\t\n\t\t' +eltAbstrait = '\t\n\t\n' if __name__ == '__main__' : -- 2.39.2