Chilkat HOME .NET Core C# Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi ActiveX Delphi DLL Go Java Lianja Mono C# Node.js Objective-C PHP ActiveX PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift 2 Swift 3,4,5... Tcl Unicode C Unicode C++ VB.NET VBScript Visual Basic 6.0 Visual FoxPro Xojo Plugin
(Delphi DLL) Xml.UpdateAttrAt Example #2Another Xml.UpdateAttrAt example...
uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, StringBuilder, Xml; ... procedure TForm1.Button1Click(Sender: TObject); var xml: HCkXml; sbValue: HCkStringBuilder; i: Integer; begin xml := CkXml_Create(); CkXml_putTag(xml,'abc'); sbValue := CkStringBuilder_Create(); i := 0; while i < 10 do begin CkXml_putI(xml,i); CkStringBuilder_Clear(sbValue); CkStringBuilder_AppendInt(sbValue,i); CkXml_UpdateAttrAt(xml,'xyz|test[i]',True,'index',CkStringBuilder__getAsString(sbValue)); i := i + 1; end; Memo1.Lines.Add(CkXml__getXml(xml)); // Output is: // <?xml version="1.0" encoding="utf-8" ?> // <abc> // <xyz> // <test index="0" /> // <test index="1" /> // <test index="2" /> // <test index="3" /> // <test index="4" /> // <test index="5" /> // <test index="6" /> // <test index="7" /> // <test index="8" /> // <test index="9" /> // </xyz> // </abc> CkXml_Dispose(xml); CkStringBuilder_Dispose(sbValue); end; |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.