self.traduitMinMax()
self.texteElt=eltDsSequence.format(self.nom,self.code,self.nomDuTypeCree,self.minOccurs,self.maxOccurs)
+ #print (self.texteComplexe)
+ #print ('------------------------------------------------')
def traduitMinMax(self):
# ____________________
class X_BLOC (X_definitionComposee):
#-----------------------------------
def dumpXsd(self):
- X_definitionComposee.dumpXsd(self)
+ #print ('------------------------------------------------')
+ #print ('dumpXsd de ' , self.nom)
+
+ self.getCode()
+ self.nomDuTypeCree = self.nomSimple()
+ self.texteSimple = "" # on n ajoute pas de type simple
+
+ self.texteComplexe = debutTypeSubst.format(self.nomDuTypeCree)
+ texteComplexeVenantDesFils=""
+ for nom in self.ordre_mc:
+ mcFils = self.entites[nom]
+ mcFils.dumpXsd()
+ self.texteComplexe += mcFils.texteElt
+ self.texteSimple += mcFils.texteSimple
+ texteComplexeVenantDesFils += mcFils.texteComplexe
+ self.texteComplexe += finTypeSubst
+ self.texteComplexe = texteComplexeVenantDesFils + self.texteComplexe
+
+ self.traduitMinMax()
+ # Pour les blocs le minOccurs vaut 0 bien sur
+ self.minOccurs=0
+ self.texteElt=substDsSequence.format(self.code,self.nomDuTypeCree,self.minOccurs,self.maxOccurs)
+ #print ('------------------------------------------------')
#--------------------------------
class X_SIMP (X_definition):
#self.traduitValMinValMax()
self.nomDuTypeDeBase = self.traduitType()
self.nomDuTypeCree = self.nomSimple()
- self.texteSimple = typeSimple.format(self.nomDuTypeCree, self.nomDuTypeDeBase)
+ if self.into != None:
+ self.texteSimple = debutTypeSimpleWithInto.format (self.nomDuTypeCree, self.nomDuTypeDeBase)
+ for val in self.into :
+ self.texteSimple += typeSimpleWithInto.format(val)
+ self.texteSimple += finTypeSimpleWithInto
+ else :
+ self.texteSimple = typeSimple.format(self.nomDuTypeCree, self.nomDuTypeDeBase)
self.texteComplexe = ""
# on se sert des listes si maxOccurs est > 0
#-----------------
def dumpXsd(self):
+
self.texteSimple = ""
self.texteComplexe = ""
self.nomDuTypeCree='T_'+self.code
self.texteSimple += commande.texteComplexe
self.texteCata += commande.texteElt
self.texteCata += finTypeCata
- self.texteElt=eltCata.format(self.code, self.nomDuTypeCree)
- print (self.texteSimple)
- print (self.texteComplexe)
- print (self.texteCata)
- print (self.texteElt)
+ self.texteElt=eltCata.format(self.code,self.code, self.nomDuTypeCree)
+
+ self.texteXSD = texteDebut.format(self.code,self.code,self.code)
+ self.texteXSD += self.texteSimple
+ self.texteXSD += self.texteCata
+ self.texteXSD += self.texteElt
+ self.texteXSD += texteFin
+ #print (self.texteSimple)
+ #print (self.texteCata)
+ #print (self.texteElt)
+ print (self.texteXSD)
def buildObjPyxb(self) :
if not self.cata.modeleMetier : return
- #print ('X_MCSIMP buildObjPyxb', self.nom, self)
+ print ('X_MCSIMP buildObjPyxb', self.nom, self)
self.monNomDeClasseModeleMetier='T_'+self.nom
self.maClasseModeleMetier=getattr(self.cata.modeleMetier,self.monNomDeClasseModeleMetier)
if self.val != None : self.objPyxb=self.maClasseModeleMetier(self.val)
if isinstance(objAccas,MCList) :
for mcfact in objAccas : listArg.append(mcfact.objPyxb)
else : listArg.append(objAccas.objPyxb)
- print (listArg)
+ #print (listArg)
self.objPyxb=self.maClasseModeleMetier(*listArg)
+
class X_MCFACT :
# --------------
class X_MCLIST:
# --------------
-
def buildObjPyxb(self,factList):
if not self.cata.modeleMetier : return
+texteDebut='<?xml version="1.0" encoding="UTF-8"?>\n<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:{}="http://chercheurs.edf.com/logiciels/{}" targetNamespace="http://chercheurs.edf.com/logiciels/{}" elementFormDefault="qualified" attributeFormDefault="qualified"\n>'
+texteFin='</schema>'
+
+# SIMP
typeSimple = '\t<simpleType name="{}">\n\t\t<restriction base="{}"/>\n\t</simpleType>\n'
+debutTypeSimpleWithInto = '\t<simpleType name="{}">\n\t\t<restriction base="{}">\n'
+typeSimpleWithInto = '\t\t\t<enumeration value="{}"/>\n'
+finTypeSimpleWithInto = '\t\t</restriction>\n\t</simpleType>\n'
eltDsSequence = '\t\t\t<element name="{}" type="{}:{}" minOccurs="{}" maxOccurs="{}"/>\n'
+# COMPO
debutTypeComplexe = '\t<complexType name="{}">\n\t\t<sequence>\n'
finTypeComplexe = '\t\t</sequence>\n\t</complexType>\n'
+eltCompoDsSequence = '\t\t\t<element name="{}" type="{}:{}" minOccurs="{}" maxOccurs="{}"/>\n'
+
+# BLOC
+debutTypeSubst = '\t<group name="{}"> minOccurs="{}" maxOccurs="{}"\n\t\t<sequence>\n'
+finTypeSubst = '\t\t</sequence>\n\t</group>\n'
+substDsSequence = '\t\t\t<group ref="{}:{}" minOccurs="{}" maxOccurs="{}"/>\n'
+
+# CATA
debutTypeCata = '\t<complexType name="{}">\n\t\t<choice minOccurs="0" maxOccurs="unbounded">\n'
finTypeCata = '\t\t</choice>\n\t</complexType> '
-
-eltCata = '<element name="JDD" type="{}:{}"/>\n'
+eltCata = '\t<element name="{}" type="{}:{}"/>\n'
if __name__ == '__main__' :
#print ("je passe dans explore pour SIMP ", self.nom)
self.dictATraiter= dictSIMPXMLEficas
self.argumentXMLToEficas()
+ #print (self.dictArgsEficas)
+
self.objAccas=A_SIMP.SIMP(**self.dictArgsEficas)
self.objAccas.nom=self.nomObj
self.traiteLesSequences()
- print (self.dictArgsEficas)
#self.convertitLesTypes()
def attendListe(self):
for param in listeParamTjsSequence :
if param in self.dictArgsEficas :
if listeDeListe == False:
- listeDElt=self.dictArgsEficas[param][0].content()
+ #print ('________________________________')
+ listeDElt=[]
+ for i in range(len(self.dictArgsEficas[param])):
+ # ou typesimple ?
+ # ici on ne sait pas si on est un type simple ou complexe ?
+ listeDElt.append(self.dictArgsEficas[param][i].content()[0])
listeRetour=self.convertitListeDsLeBonType(listeDElt)
+ #print (listeRetour)
+ #print ('________________________________')
self.dictArgsEficas[param]=listeRetour
else :
listeResultat=[]
class monCata(efficas.T_cata):
# ------------------------------
def exploreCata(self):
+ # PNPNPN --> il faut revoir ce mecanisme
+ self.modeleMetier = None
# On positionne le contexte ACCAS
- self.JdC = JDC_CATA (code = 'MED', execmodul = None,)
+ self.JdC = JDC_CATA (code = 'Atmo', execmodul = None,)
self.contexteXML={}
objAExplorer=self.commandes[0]
for obj in objAExplorer.content():