1. Home
  2. Computing & Technology
  3. Delphi Programming

Reading and Manipulating XML files (RSS feeds) with Delphi

By , About.com Guide

4 of 4

Full Source Code

I suppose the code is more or less easy to understand:
  1. Make sure FileName property of the TXMLDocument points to our XML file.
  2. Set Active to True
  3. Find the first <item> ("meat") node
  4. Iterate through all the <item> nodes and grab the information they cary.
  5. Add each <item> node's value to ListView

Maybe only the next line can be confusing: StartItemNode := XMLDoc.DocumentElement.ChildNodes.First.ChildNodes.FindNode('item') ;

The DocumentElement property of the XMLDoc provides access to the root node of the document. This root node is the <rss> element. Next, ChildNodes.First returns the only child node to the <rss> element, which is the <channel> node. Now, ChildNodes.FindNode('item') finds the first "meat" node. Once we have the first <item> node we simply iterate through all the "meat" nodes in the document. The NextSibling method returns the next child of a node’s parent.

That's it. Make sure you download the full source. And of course, feel free and encouraged to post any comments to this article on our Delphi Programming Forum.

Explore Delphi Programming
About.com Special Features

Holiday Central

What to eat, where to go, fun things to do and how to save money on the perfect gifts. More >

Family Tech Center

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

  1. Home
  2. Computing & Technology
  3. Delphi Programming
  4. Coding Internet / Network
  5. Reading and Manipulating XML files (RSS feeds) with Delphi

©2009 About.com, a part of The New York Times Company.

All rights reserved.