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)
+ if self.defaut :
+ if self.max > 1 or self.max == '**' or self.max == float('inf') :
+ # a revoir pour les tuples avec defaut
+ txtDefaut=""
+ for val in self.defaut : txtDefaut+=str(val) +" "
+ self.texteElt = eltWithDefautDsSequence.format(self.nom,self.code,self.nomDuTypePyxb,minOccurs,1,txtDefaut)
+ else :
+ self.texteElt = eltWithDefautDsSequence.format(self.nom,self.code,self.nomDuTypePyxb,minOccurs,1,self.defaut)
+
+ else : 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
+ self.texteSimple += debutSimpleType.format(self.nomDuTypePyxb)
+ # On est dans une liste
+ if self.max > 1 or self.max == '**' or self.max == float('inf') :
+ self.texteSimple += debutTypeSimpleListe
+ self.texteSimple += "\t\t\t\t"+debutRestrictionBase.format(self.nomDuTypeDeBase)
+ if self.val_min != float('-inf') : self.texteSimple += "\t\t\t\t"+minInclusiveBorne.format(self.val_min)
+ if self.val_max != float('inf') and self.val_max != '**' : self.texteSimple +="\t\t\t\t"+ maxInclusiveBorne.format(self.val_max)
+ if self.into != None:
+ for val in self.into : self.texteSimple += "\t\t\t\t"+enumeration.format(val)
+ self.texteSimple += fermeBalisesMileu
+ if self.max !=1 and self.max != '**' and self.max != float('inf') : self.texteSimple += maxLengthTypeSimple.format(self.max)
+ if self.min !=1 and self.min != float('-inf') : self.texteSimple += minLengthTypeSimple.format(self.min)
+ self.texteSimple += fermeRestrictionBase
+ else :
+ # ou pas
+ self.texteSimple += debutRestrictionBase.format(self.nomDuTypeDeBase)
+ if self.val_min != float('-inf') : self.texteSimple += minInclusiveBorne.format(self.val_min)
+ if self.val_max != float('inf') and self.val_max != '**' : self.texteSimple += maxInclusiveBorne.format(self.val_max)
+ if self.into != None:
+ for val in self.into : self.texteSimple += enumeration.format(val)
+ self.texteSimple += fermeRestrictionBase
+ self.texteSimple += fermeSimpleType
#if self.max > 1 : self.isListe=True
# il faut ajouter les regles
# il faut gerer les types tuple et fichier
- if hasattr(self.type[0], 'label') and self.type[0].label == "Tuple" : return ('XXXXXXXX')
+ if hasattr(self.type[0], 'ntuple') : return ('XXXXXXXX')
#print (self.type[0])
return dictNomsDesTypes[self.type[0]]
# SIMP
-debTypeSimpleNom = '\t<simpleType name="{}">\n'
-finTypeSimpleNom = '\t</simpleType>\n'
-debTypeSimpleListe = '\t\t<list><simpleType>\n'
-finTypeSimpleListe = '\t\t</simpleType></list>\n'
-debTypeSimpleType = '\t\t<restriction base="{}">\n'
-finTypeSimpleType = '\t\t</restriction>\n'
-maxLengthTypeSimple = '\t\t\t<maxLenght value = "{}" />\n'
-minLengthTypeSimple = '\t\t\t<minLenght value = "{}" />\n'
-maxBorneTypeSimple = '\t\t\t<maxInclusive value = "{}" />\n'
-minBorneTypeSimple = '\t\t\t<minInclusive value = "{}" />\n'
-typeSimpleWithInto = '\t\t\t<enumeration value="{}"/>\n'
+debutSimpleType = '\t<simpleType name="{}">\n'
+fermeSimpleType = '\t</simpleType>\n'
+debutRestrictionBase = '\t\t<restriction base="{}">\n'
+fermeRestrictionBase = '\t\t</restriction>\n'
+enumeration = '\t\t\t<enumeration value="{}"/>\n'
+maxInclusiveBorne = '\t\t\t<maxInclusive value = "{}"/>\n'
+minInclusiveBorne = '\t\t\t<minInclusive value = "{}"/>\n'
+
+debutTypeSimpleListe = '\t\t<restriction>\n\t\t\t<simpleType>\n\t\t\t\t<list>\n\t\t\t\t\t<simpleType>\n'
+finTypeSimpleListe = '\t\t<restriction>\n\t\t\t<simpleType>\n\t\t\t\t<list>\n\t\t\t\t\t<simpleType>\n'
+fermeBalisesMileu = '\t\t\t\t\t\t</restriction>\n\t\t\t\t\t</simpleType>\n\t\t\t\t</list>\n\t\t\t </simpleType>\n'
+
+maxLengthTypeSimple = '\t\t\t<maxLength value = "{}"/>\n'
+minLengthTypeSimple = '\t\t\t<minLength value = "{}"/>\n'
eltDsSequence = '\t\t\t<element name="{}" type="{}:{}" minOccurs="{}" maxOccurs="{}"/>\n'
+eltWithDefautDsSequence = '\t\t\t<element name="{}" type="{}:{}" minOccurs="{}" maxOccurs="{}" default="{}"/>\n'
# COMPO
#debutTypeCompo = '\t<complexType name="{}" >\n\t\t<sequence minOccurs="{}" maxOccurs="{}">\n'
eltRacine=eltCata.format(nomDuCode, 'T_'+nomDuCode)
print (texteSimple+texteComplexe+texteCata+eltRacine)
-#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'