Parse An RSS Feed Using Delphi XE5 Firemonkey On Android And IOS

Parse RSS Feed In Delphi Firemonkey Android IOSIf you want to manually parse an RSS feed and not use Livebindings here is a code snippet to do that using the built in TXMLDocument. First drop a TXMLDocument on the Form and be sure to set the DOMVendor to ‘ADOM XML v4’ (this will allow it to work on Android and IOS). Next up get your XML string from your REST Client or load it from a file and using XMLDoc.LoadFromXML() to load it into the XML component. Walk through the child nodes until you get to the node depth that you want (in the case of an RSS feed this is three levels deep. Check the NodeName to see if it the one you want (like Title) and then read out the Text value to get the value of that node. If there is a different node name that isn’t in the same you can add code to look for it instead of the sample ones I provided. Check out the full source code snippet below:

This code snippet is in the the AfterExecute event of a TRESTRequest component and reads out the XML from the Content property. Download a copy of the sample code snippet.

Have Delphi Firemonkey questions? Ask and get answers on StackOverflow.

Leave a Reply

Show Buttons
Hide Buttons
Read previous post:
Parse JSON With Delphi XE5 Firemonkey on Android And IOS

There is a JSON parsing library called SuperObject for Delphi however it doesn't support XE5. A free fork of the...