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

Scan XML Document in Delphi

Download Delphi Source Code and Project Files

Source Code Listing

// This example requires Chilkat XML v3.0.0
// Iterate over each "DOC" record and copy the
// ArticleTitle to a new XML document
procedure TForm1.Example2Click(Sender: TObject);
var
	xml: IChilkatXml;
	outXml: IChilkatXml;

begin
	xml := CoChilkatXml.Create();
	outXml := CoChilkatXml.Create();

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

	// Create the output XML document in-memory
	outXml.Tag := 'article_titles';

	// Iterate over the "DOC" nodes by calling FirstChild2
	// followed by NextSibling2 repeatedly until it returns false.
	// Calling FirstChild2 updates our internal reference to the first child.
	if (xml.FirstChild2() = 0) then
		xml := nil;

	while (xml <> nil) do
	begin
		// FindChild2 updates our internal reference to the found child.
		if (xml.FindChild2('ArticleTitle') = 1) then
		begin
			// NewChild returns the created child, whereas NewChild2 does not.
			outXml.NewChild2('article',xml.Content);
			// Restore our internal reference back to the parent.
			xml.GetParent2();
		end;

		// Move to the next sibling. The internal reference within node is updated
		// to the node's next sibling. If no siblings remain, it returns 0.
		if (xml.NextSibling2() = 0) then
		xml := nil;
	end;

	outXml.SaveXml('ArticleTitles2.xml');

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