Einzelnen Beitrag anzeigen

Blup

Registriert seit: 7. Aug 2008
Ort: Brandenburg
1.429 Beiträge
 
Delphi 10.4 Sydney
 
#4

AW: wie komm ich nur an die Werte ?

  Alt 7. Mär 2018, 09:20
Nicht getestet:
Delphi-Quellcode:
procedure SetIndexValue(ADoc: IXMLDocument; const AIndex, AValue: string);
var
  IndexNode, Node: IXmlNode;
  i: Integer;
begin
  IndexNode := ADoc.ChildNodes.Nodes['Index'];
  {Suchen und Ändern}
  for i := 0 to IndexNode.ChildNodes.Count - 1 do
  begin
    Node := IndexNode.ChildNodes[i];
    if (Node.NodeName = 'Var') and (Node.Attributes['Name'] = AIndex) then
    begin
      Node.Attributes['Value'] := AValue;
      Exit;
    end;
  end;
  {nicht gefunden, neu anlegen}
  Node := IndexNode.AddChild(AIndex);
  Node.Attributes['Name'] := AIndex;
  Node.Attributes['Value'] := AValue;
end;

SetIndexValue(xmlDox, '*ADRESSNR', '08157');
  Mit Zitat antworten Zitat