quand je lance cette Procedure tout mes Tedit se charge du fichier XML
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
 
procedure TFenetre_Principal.Ouvrir(fiche:string);
var
  lexml : IXMLDOMDocument;
  noeuxImDep, noeuxInNum, noeuxImCom, noeuxImAdr, noeuxImSec, noeuxImPar, noeuxImNat, noeuxImEta, noeuxDeNom, noeuxDePre, noeuxDeAdr, noeuxDeCod, noeuxDeCom, noeuxDeQua, noeuxExIde, noeuxExNom, noeuxExPre, noeuxExRai, noeuxExAdr, noeuxExCod, noeuxExCom, noeuxExAss, noeuxExNbp: IXMLDOMNode ;
  nodes,noeuxCoInfo,noeuxCoEnqu ,noeuxCom : IXMLDOMNodeList;
  //noeuxImDep:string;
    d,g: integer;
begin
 
  lexml := CoDOMDocument.Create;
  lexml.async :=false;
  lexml.load(fiche);
 
 
  noeuxInNum := lexml.selectSingleNode('//introduction/NumeroDevis');
 
  noeuxImDep := lexml.selectSingleNode('//immeuble/Departement');
  noeuxImCom := lexml.selectSingleNode('//immeuble/Commune');
  noeuxImAdr := lexml.selectSingleNode('//immeuble/Adresse');
  noeuxImSec := lexml.selectSingleNode('//immeuble/Section');
  noeuxImPar := lexml.selectSingleNode('//immeuble/Numparcelle');
  noeuxImNat := lexml.selectSingleNode('//immeuble/Nature');
  noeuxImEta := lexml.selectSingleNode('//immeuble/Numetage');
 
  noeuxDeNom := lexml.selectSingleNode('//demandeur/Nom');
  noeuxDePre := lexml.selectSingleNode('//demandeur/Prenom');
  noeuxDeAdr := lexml.selectSingleNode('//demandeur/Adresse');
  noeuxDeCod := lexml.selectSingleNode('//demandeur/Codepostal');
  noeuxDeCom := lexml.selectSingleNode('//demandeur/Commune');
  noeuxDeQua := lexml.selectSingleNode('//demandeur/Qualite');
 
  noeuxExIde := lexml.selectSingleNode('//expert/Id_Expert');
  noeuxExNom := lexml.selectSingleNode('//expert/Nom');
  noeuxExPre := lexml.selectSingleNode('//expert/Prenom');
  noeuxExRai := lexml.selectSingleNode('//expert/Raison');
  noeuxExAdr := lexml.selectSingleNode('//expert/Adresse');
  noeuxExCod := lexml.selectSingleNode('//expert/Cp');
  noeuxExCom := lexml.selectSingleNode('//expert/Commune');
  noeuxExAss := lexml.selectSingleNode('//expert/Assurance');
  noeuxExNbp := lexml.selectSingleNode('//expert/Nbpolice');
 
  noeuxCoInfo := lexml.selectNodes('//conclusion/infoNonBati');
  noeuxCoEnqu := lexml.selectNodes('//conclusion/concluEnquete');
 
  noeuxCom := lexml.selectNodes('//introduction/CommentaireDevis');
  EDT_NumDossier.Text  := noeuxInNum.text;
 
  for g:=0 to noeuxCom.length-1 do
    begin
      CommentaireSup.Lines.Add(noeuxCom.item[g].text);
    end;
 
  EDT_Departement_Immeuble.Text := noeuxImDep.Text;
  EDT_Commune_Immeuble.Text := noeuxImCom.Text;
  EDT_Adresse_Immeuble.Text := noeuxImAdr.Text;
  EDT_Section_Immeuble.Text := noeuxImSec.Text;
  EDT_Numparcelle_Immeuble.Text := noeuxImPar.Text;
  EDT_Nature_Immeuble.Text := noeuxImNat.Text;
  EDT_Numetage_Immeuble.Text := noeuxImEta.Text;
 
  EDT_Nom_Demandeur.Text := noeuxDeNom.Text;
  EDT_Prenom_Demandeur.Text := noeuxDePre.Text;
  EDT_Adresse_Demandeur.Text := noeuxDeAdr.Text;
  EDT_Codepostal_Demandeur.Text := noeuxDeCod.Text;
  EDT_Commune_Demandeur.Text := noeuxDeCom.Text;
  EDT_Qualite_Demandeur.Text := noeuxDeQua.Text;
 
  CB_Id_Expert.Text := noeuxExIde.Text;
  EDT_Nom_Expert.Text := noeuxExNom.Text;
  EDT_Prenom_Expert.Text := noeuxExPre.Text;
  EDT_Raison_Expert.Text := noeuxExRai.Text;
  EDT_Adresse_Expert.Text := noeuxExAdr.Text;
  EDT_Cp_Expert.Text := noeuxExCod.Text;
  EDT_Commune_Expert.Text := noeuxExCom.Text;
  EDT_Assurance_Expert.Text := noeuxExAss.Text;
  EDT_Nbpolice_Expert.Text := noeuxExNbp.Text;
 
 
individuel.Checked := TestCheckBox(lexml.selectSingleNode('//introduction/individuel').text) ;
 
Appart.Checked := TestCheckBox(lexml.selectSingleNode('//introduction/Appart').text) ;
 
CuisineEvier.Checked := TestCheckBox(lexml.selectSingleNode('//Conformite/CuisineEvier').text) ;
 
CuisineSiphon.Checked := TestCheckBox(lexml.selectSingleNode('//Conformite/CuisineSiphon').text) ;
 
CuisinePotable.Checked := TestCheckBox(lexml.selectSingleNode('//Conformite/CuisinePotable').text) ;
 
CuisineEauFroide.Checked := TestCheckBox(lexml.selectSingleNode('//Conformite/CuisineEauFroide').text) ;
 
CuisineEauChaude.Checked := TestCheckBox(lexml.selectSingleNode('//Conformite/CuisineEauChaude').text) ;
 
CuisineEdfGdf.Checked := TestCheckBox(lexml.selectSingleNode('//Conformite/CuisineEdfGdf').text) ;
 
CuisineAerationFenetre.Checked := TestCheckBox(lexml.selectSingleNode('//Conformite/CuisineAerationFenetre').text) ;
 
CuisineAerationHaute.Checked := TestCheckBox(lexml.selectSingleNode('//Conformite/CuisineAerationHaute').text)  ;
 
BainBaignoire.Checked := TestCheckBox(lexml.selectSingleNode('//Conformite/BainBaignoire').text)  ;
 
BainLavabo.Checked := TestCheckBox(lexml.selectSingleNode('//Conformite/BainLavabo').text)  ;
 
BainDouche.Checked := TestCheckBox(lexml.selectSingleNode('//Conformite/BainDouche').text)  ;
 
BainAerationFenetre.Checked := TestCheckBox(lexml.selectSingleNode('//Conformite/BainAerationFenetre').text)  ;
 
BainAerationHaute.Checked := TestCheckBox(lexml.selectSingleNode('//Conformite/BainAerationHaute').text)  ;
 
 
 
 
WcSituation.Checked := TestCheckBox(lexml.selectSingleNode('//Conformite/WcSituation').text)  ;
 
WcSeparee.Checked := TestCheckBox(lexml.selectSingleNode('//Conformite/WcSeparee').text)  ;
 
WcSalleDeau.Checked := TestCheckBox(lexml.selectSingleNode('//Conformite/WcSalleDeau').text)  ;
 
WcExterieur.Checked := TestCheckBox(lexml.selectSingleNode('//Conformite/WcExterieur').text)  ;
 
WcAerationFenetre.Checked := TestCheckBox(lexml.selectSingleNode('//Conformite/WcAerationFenetre').text)  ;
 
WcAerationHaute.Checked := TestCheckBox(lexml.selectSingleNode('//Conformite/WcAerationHaute').text)  ;
 
 
 
ChauffageCollectif.Checked := TestCheckBox(lexml.selectSingleNode('//Conformite/ChauffageCollectif').text)  ;
 
ChauffageIndividuel.Checked := TestCheckBox(lexml.selectSingleNode('//Conformite/ChauffageIndividuel').text)  ;
 
ChauffageAutre.Checked := TestCheckBox(lexml.selectSingleNode('//Conformite/ChauffageAutre').text)  ;
 
ChauffageEdtAutre.Text := lexml.selectSingleNode('//Conformite/ExterieurCour').text ;
 
CBXInterieur.Text := lexml.selectSingleNode('//Conformite/CBXInterieur').text ;
 
Interieur.Checked := TestCheckBox(lexml.selectSingleNode('//Conformite/Interieur').text)  ;
 
CBXExterieurRue.Text := lexml.selectSingleNode('//Conformite/CBXExterieurRue').text ;
 
ExterieurRue.Checked := TestCheckBox(lexml.selectSingleNode('//Conformite/ExterieurRue').text)  ;
 
CBXExterieurCour.Text := lexml.selectSingleNode('//Conformite/CBXExterieurCour').text ;
 
ExterieurCour.Checked := TestCheckBox(lexml.selectSingleNode('//Conformite/ExterieurCour').text)  ;
 
CBXExterieurCouverture.Text := lexml.selectSingleNode('//Conformite/CBXExterieurCouverture').text  ;
 
ExterieurCouverture.Checked := TestCheckBox(lexml.selectSingleNode('//Conformite/ExterieurCouverture').text)  ;
 
 
etencheite.Checked := TestCheckBox(lexml.selectSingleNode('//Conformite/etencheite').text)  ;
 
for g:=0 to lexml.selectNodes('//Conformite/etencheiteMemo').length-1 do
  begin
      etencheiteMemo.Lines.Add(lexml.selectNodes('//Conformite/etencheiteMemo').item[g].text)
  end;
 
 
ConcluSurface.Checked := TestCheckBox(lexml.selectSingleNode('//conclusion/ConcluSurface').text)  ;
 
ConcluHabitabilite.Checked := TestCheckBox(lexml.selectSingleNode('//conclusion/ConcluHabitabilite').text)  ;
 
for g:=0 to lexml.selectNodes('//conclusion/ConcluMemo').length-1 do
    begin
      ConcluMemo.Lines.Add(lexml.selectNodes('//conclusion/ConcluMemo').item[g].text)
    end;
 
 
 
end;
Puis si je lance après cette procedure j'ai cette erreure

Ce qui est bizard c'est que si je lance que la procedure ideChange il y a aucune erreur et si je lance les procedures dans le sens idechange puis ouvrir il y a aucune erreur .
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
 
procedure TFenetre_Principal.ideChange(Sender: TObject);
var leNoeud : IXMLDOMNode;
Unexml : IXMLDOMDocument;
begin
  Unexml := CoDOMDocument.Create;
  Unexml.async :=false;
  Unexml.load('../GestionXML/Client.xml');
  leNoeud := Unexml.selectSingleNode('//Client[id="'+Ide.Text+'"]');
 
  if not (Ide.Text = '') then
    begin
      EDT_Nom_Demandeur.Text := leNoeud.childNodes.item[2].text ;
      EDT_Prenom_Demandeur.Text := leNoeud.childNodes.item[3].text ;
      EDT_Adresse_Demandeur.Text := leNoeud.childNodes.item[4].text ;
      EDT_Codepostal_Demandeur.Text := leNoeud.childNodes.item[5].text ;
      EDT_Commune_Demandeur.Text := leNoeud.childNodes.item[6].text ;
    end;
 
end;