Bonjour
Je suis en train de créer un fichier XML et j'ai voulu affecter un named space à mon document.
J'ai utilisé la méthode SetAttributeNS.
l'affectation fonctionne mais un attribut vide a été affecté également au nœud du niveau suivant !
Comment peut-on l’empêcher ?
Mon source :
j'ai mis en pièce jointe la visualisation des lignes XML obtenus
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 procedure TForm1.Button1Click(Sender: TObject); var iNode : IXmlNode; begin XMLdoc.Active := False; XMLdoc.Active := True; XMLdoc.ChildNodes.Clear; XMLdoc.Version := '1.0'; XMLdoc.Encoding := 'UTF-8'; INode := XMLdoc.AddChild('Document'); INode.SetAttributeNS('xmlns', '', 'urn:iso:std:iso:20022:tech:xsd:pain.001.001.02' ); With INode do begin with AddChild('pain.001.001.02') do begin with AddChild('GrpHdr') do begin AddChild('MsgID').Text := 'MESS2011-1'; AddChild('CreDtTm').Text := '2013-12-03T10:18:35'; AddChild('NbOfTxs').Text := '1'; AddChild('CtrlSum').Text := '1320.73'; AddChild('Grpg').Text := 'MIXD'; With AddChild('InitPty') do
Merci d'avance pour votre aide
Partager