From f19c1c1ca8d635bfcefb5771c872c2d9fcd12d00 Mon Sep 17 00:00:00 2001 From: "pascale.noyret" Date: Mon, 12 Nov 2018 17:15:06 +0100 Subject: [PATCH] dump --- Efi2Xsd/AccasXsd.py | 72 +++++++++++++++++++++++++++------------------ Efi2Xsd/balises.py | 59 ++++++++++++++++++++++++++++++------- 2 files changed, 92 insertions(+), 39 deletions(-) diff --git a/Efi2Xsd/AccasXsd.py b/Efi2Xsd/AccasXsd.py index 067aeff4..6905e17f 100755 --- a/Efi2Xsd/AccasXsd.py +++ b/Efi2Xsd/AccasXsd.py @@ -105,21 +105,15 @@ class X_definitionComposee (X_definition): else : self.texteComplexe = "" - minDsSequence=0 - if hasattr(self, 'statut') and self.statut=='f' : minDsSequence=0 - maxDsSequence=1 - if self.label in ('BLOC', 'FACT'): - self.texteElt=eltCompoDsSequence.format(self.nom,self.code,self.nomDuTypePyxb,minDsSequence,maxDsSequence) - else : - self.texteElt=eltCompoDsSequenceSiProc.format(self.nom,self.code,self.nomDuTypePyxb) + self.texteElt=eltCompoDsSequence.format(self.nom,self.code,self.nomDuTypePyxb,self.minOccurs,self.maxOccurs) #print (self.texteComplexe) #print ('------------------------------------------------') def traduitMinMax(self): - # ____________________ - # valable pour bloc, proc et oper + # ______________________ + # valable pour PROC et OPER self.minOccurs = 0 - self.maxOccurs = 1 + self.maxOccurs = "unbounded" def compare(self,autreMC): if self.label != autreMC.label : return False @@ -194,32 +188,52 @@ class X_SIMP (X_definition): #print ('exploreObjet SIMP') self.getCode() self.aCreer = True + self.texteComplexe = "" + self.texteSimple = "" - # --> homonymie on peut utiliser genealogie - #self.traduitMinMax() - #self.traduitValMinValMax() + # --> homonymie on peut utiliser genealogie ? self.nomDuTypeDeBase = self.traduitType() self.nomDuTypePyxb = self.definitNomDuTypePyxb() - if self.aCreer == True : - self.texteSimple = debutTypeSimple.format (self.nomDuTypePyxb, self.nomDuTypeDeBase) - if self.into != None: - self.texteSimple = self.texteSimple + ">\n" - for val in self.into : - self.texteSimple += withInto.format(val) - self.texteSimple += finWithInto - else : - self.texteSimple += finRestriction - self.texteSimple += finTypeSimple - else : - # le type existe deja - self.texteSimple="" - self.texteComplexe = "" - # on se sert des listes si maxOccurs est > 0 - # a gerer dans le dump + # on se sert des listes ou non pour la gestion des minOccurs /maxOccurs est > 0 if self.statut =='f' : minOccurs = 0 else : minOccurs = 1 + # le defaut est dans l elt Name -> tester la coherence d existence avec Accas + # regles Accas self.texteElt = eltDsSequence.format(self.nom,self.code,self.nomDuTypePyxb,minOccurs,1) + + # self.aCreer est mis a jour ds definitNomDuTypePyxb + if not self.aCreer : return + + self.texteSimple += debTypeSimpleNom.format(self.nomDuTypePyxb) + if self.max > 1 or self.max == '**' or self.max == float('inf') : self.texteSimple += debTypeSimpleListe + self.texteSimple += debTypeSimpleType.format(self.nomDuTypeDeBase) + if self.into != None: + for val in self.into : self.texteSimple += typeSimpleWithInto.format(val) + if self.val_min != float('-inf') : self.texteSimple += minBorneTypeSimple.format(self.val_min) + if self.val_max != float('inf') : self.texteSimple += maxBorneTypeSimple.format(self.val_max) + if self.max !=1 and self.max != '**' and self.val_max != float('inf') : self.texteSimple += maxLengthTypeSimple.format(self.max) + if self.min !=1 and self.val_min != float('-inf') : self.texteSimple += minLengthTypeSimple.format(self.min) + self.texteSimple += finTypeSimpleType + if self.max > 1 or self.max == '**' or self.max == float('inf'): self.texteSimple += finTypeSimpleListe + self.texteSimple += finTypeSimpleNom + + + #if self.max > 1 : self.isListe=True + #else : self.isListe =False + #if self.aCreer == True : + # if self.isListe : self.texteSimple = debutTypeSimpleListe.format(self.nomDuTypePyxb, self.nomDuTypeDeBase) + # else : self.texteSimple = debutTypeSimple.format (self.nomDuTypePyxb, self.nomDuTypeDeBase) + # if self.into != None: + # self.texteSimple = self.texteSimple + ">\n" + # for val in self.into : + # self.texteSimple += withInto.format(val) + # self.texteSimple += finWithInto + # else : + # self.texteSimple += fermeBalise + # self.texteSimple += finTypeSimple + #else : + # le type existe deja def traduitType(self): diff --git a/Efi2Xsd/balises.py b/Efi2Xsd/balises.py index a400b1c9..53ea6d2d 100644 --- a/Efi2Xsd/balises.py +++ b/Efi2Xsd/balises.py @@ -1,18 +1,21 @@ texteDebut='\n\n' texteFin='' +fermeBalise = "/>" # SIMP -#typeSimple = '\t\n\t\t\n\t\n' -#debutTypeSimpleWithInto = '\t\n\t\t\n' -#typeSimpleWithInto = '\t\t\t\n' -#finTypeSimpleWithInto = '\t\t\n\t\n' -debutTypeSimple = '\t\n\t\t\n\t\t\n' finTypeCompo = '\t\t\n\t\n' eltCompoDsSequence = '\t\t\t\n' -eltCompoDsSequenceSiProc = '\t\t\t\n' # BLOC debutTypeSubst = '\t \n\t\t\n' @@ -42,6 +44,39 @@ if __name__ == '__main__' : nomDuCode='monCode' minOccurs=1 maxOccurs=1 + nomDuTypePyxb = "T_simulation_title" + nomDuTypeDeBase = 'string' + into=None + + isListe=False + if isListe : texteSimple = debutTypeSimpleListe.format(nomDuTypePyxb, nomDuTypeDeBase) + else : texteSimple = debutTypeSimple.format (nomDuTypePyxb, nomDuTypeDeBase) + if into != None: + texteSimple = self.texteSimple + ">\n" + for val in into : + texteSimple += withInto.format(val) + texteSimple += finWithInto + else : + texteSimple += fermeBalise + texteSimple += finTypeSimple + + #print texteSimple + #exit() + + isListe=True + if isListe : texteSimple = debutTypeSimpleListe.format(nomDuTypePyxb, nomDuTypeDeBase) + else : texteSimple = debutTypeSimple.format (nomDuTypePyxb, nomDuTypeDeBase) + if into != None: + texteSimple = self.texteSimple + ">\n" + for val in into : + texteSimple += withInto.format(val) + texteSimple += finWithInto + else : + texteSimple += fermeBalise + texteSimple += finTypeSimple + + print texteSimple + exit() texteSimple=typeSimple.format(nomDuType, nomDuTypeBase) texteElt=eltDsSequence.format(nomElt,nomDuCode,nomDuType,minOccurs,maxOccurs) @@ -59,3 +94,7 @@ if __name__ == '__main__' : eltRacine=eltCata.format(nomDuCode, 'T_'+nomDuCode) print (texteSimple+texteComplexe+texteCata+eltRacine) +#typeSimple = '\t\n\t\t\n\t\n' +#debutTypeSimpleWithInto = '\t\n\t\t\n' +#typeSimpleWithInto = '\t\t\t\n' +#finTypeSimpleWithInto = '\t\t\n\t\n' -- 2.39.2