]> SALOME platform Git repositories - tools/eficas.git/blob - Efi2Xsd/balises.py
Salome HOME
update version
[tools/eficas.git] / Efi2Xsd / balises.py
1 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>'
2 texteFin='</schema>'
3
4 # SIMP
5 typeSimple    = '\t<simpleType name="{}">\n\t\t<restriction base="{}"/>\n\t</simpleType>\n'
6 debutTypeSimpleWithInto  = '\t<simpleType name="{}">\n\t\t<restriction base="{}">\n'
7 typeSimpleWithInto       = '\t\t\t<enumeration value="{}"/>\n'
8 finTypeSimpleWithInto    = '\t\t</restriction>\n\t</simpleType>\n'
9 eltDsSequence = '\t\t\t<element name="{}" type="{}:{}" minOccurs="{}" maxOccurs="{}"/>\n'
10
11 # COMPO
12 debutTypeCompo = '\t<complexType name="{}" >\n\t\t<sequence minOccurs="{}" maxOccurs="{}">\n'
13 finTypeCompo   = '\t\t</sequence>\n\t</complexType>\n'
14 eltCompoDsSequence = '\t\t\t<element name="{}" type="{}:{}" minOccurs="{}" maxOccurs="{}"/>\n'
15 eltCompoDsSequenceSiProc = '\t\t\t<element name="{}" type="{}:{}" />\n'
16
17 # BLOC
18 debutTypeSubst = '\t<group name="{}">   \n\t\t<sequence>\n'
19 finTypeSubst   = '\t\t</sequence>\n\t</group>\n'
20 substDsSequence = '\t\t\t<group ref="{}:{}"  minOccurs="{}" maxOccurs="{}"/>\n'
21
22
23 # CATA
24 debutTypeCata = '\t<complexType name="{}">\n\t\t<choice minOccurs="0" maxOccurs="unbounded">\n'
25 finTypeCata   = '\t\t</choice>\n\t</complexType> '
26 eltCata = '\t<element name="{}" type="{}:{}"/>\n'
27
28
29 if __name__ == '__main__' :
30     nomElt='Simple'
31     nomDuType='T_Simple'
32     nomDuTypeBase='int'
33     nomDuComplexe='T_Complexe'
34     nomDuCode='monCode'
35     minOccurs=1
36     maxOccurs=1
37
38     texteSimple=typeSimple.format(nomDuType, nomDuTypeBase)
39     texteElt=eltDsSequence.format(nomElt,nomDuCode,nomDuType,minOccurs,maxOccurs)
40
41     minOccurs=0
42     texteComplexe=debutTypeComplexe.format(nomDuComplexe)
43     texteComplexe+=texteElt
44     texteComplexe+=finTypeComplexe
45     texteEltComplexe=eltDsSequence.format(nomElt,nomDuCode,nomDuType,minOccurs,maxOccurs)
46
47     texteCata=debutTypeCata.format(nomDuCode)
48     texteCata+=texteEltComplexe
49     texteCata+=finTypeCata
50
51     eltRacine=eltCata.format(nomDuCode, 'T_'+nomDuCode)
52     print (texteSimple+texteComplexe+texteCata+eltRacine)