Sample code for 30+ languages & platforms
Delphi ActiveX

SearchAllForContent

See more XML Examples

Demonstrates the SearchAllForContent method.

Chilkat Delphi ActiveX Downloads

Delphi ActiveX
uses
    Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
    Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Chilkat_TLB;

...

procedure TForm1.Button1Click(Sender: TObject);
var
success: Integer;
xml: TChilkatXml;
xBeginAfter: IChilkatXml;
xFound: IChilkatXml;
searchForMore: Integer;

begin
success := 0;

xml := TChilkatXml.Create(Self);

success := xml.LoadXmlFile('qa_data/xml/pigs.xml');
if (success <> 1) then
  begin
    Memo1.Lines.Add(xml.LastErrorText);
    Exit;
  end;

xBeginAfter := xml.GetSelf();
xFound := xml.SearchAllForContent(xBeginAfter,'*pig*');
searchForMore := 1;
while (searchForMore = 1) do
  begin

    Memo1.Lines.Add(xFound.Tag);
    Memo1.Lines.Add(xFound.Content);
    Memo1.Lines.Add('--');

    xBeginAfter := xFound;
    xFound := xml.SearchAllForContent(xBeginAfter,'*pig*');

    searchForMore := xml.LastMethodSuccess;
  end;
end;