Delphi Examples

ChilkatHOMEASPVisual BasicVB.NETC#Visual C++CMFCDelphiFoxProJavaPerlPHPPythonRubySQL ServerVBScript

Delphi Examples

Bounced Mail
Character Encoding
Digital Certificates
Digital Signatures
Email
FTP
HTML-to-XML
HTTP
IMAP
Encryption
MHT / HTML Email
RSA Encryption
S/MIME
Socket
Spider
String
Tar
Upload
XML
XMP
Zip Compression

More Examples...
Byte Array
Email Object
POP3
SMTP
RSS
Atom
Self-Extractor
Service
PPMD
Deflate
DH Key Exchange
DSA

Unreleased...
Bzip2
LZW
Bz2
Icon

Type Conversion

 

Article: Understanding COM References in Delphi

Find Matching XML Records in Delphi

Download Delphi Source Code and Project Files

Source Code Listing

// Iterate over the ArticleTitles beginning with 'M'
// using FindNextRecord.   Move these records from
// the input XML document to the output XML document.
procedure TForm1.Example6Click(Sender: TObject);
var
  xmlDoc: IChilkatXml;
  outXml: IChilkatXml;
  rec1: IChilkatXml;
  rec2: IChilkatXml;
begin
    xmlDoc := CoChilkatXml.Create();
    outXml := CoChilkatXml.Create();
    outXml.Tag := 'MRecords';


    // Load the input document.
    xmlDoc.LoadXmlFile('crisp.xml');


    // Find the first article beginning with M
    rec1 := xmlDoc.FirstChild();


    // If rec1 matches, it returns itself.
    rec1 := rec1.FindNextRecord('ArticleTitle','M*');
    while (rec1 <> nil) do
    begin
        // Continue the search with the next sibling.
        rec2 := rec1.NextSibling();

        // This has the effect of removing the subtree rooted
        // at rec from xmlDoc, and adding it to outXml
        outXml.AddChildTree(rec1);

        if (rec2 <> nil) then
          rec1 := rec2.FindNextRecord('ArticleTitle','M*')
        else
          rec1 := nil;
    end;

    // Save the output document.
    outXml.SaveXml('MRecords.xml');

    // The original document is now without articles
    // beginning with M
    xmlDoc.SaveXml('MissingMRecords.xml');

end;

end.


 

Need a specific example? Send a request to support@chilkatsoft.com

© 2000-2007 Chilkat Software, Inc. All Rights Reserved.

Mail Component · .NET Email Component · XML Parser