Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 3 of 3 total
Thread RSS Feeds
Tue, Oct 24 2017 4:07 PMPermanent Link



Is it possible to display RSS feeds in EWB?

// Thom
Wed, Oct 25 2017 4:14 AMPermanent Link

Matthew Jones

thomh wrote:

> Is it possible to display RSS feeds in EWB?

RSS is just XML, and I did XML processing in EWB v1 so it must be possible. That said, I'm struggling to find my code as everything went JSON, and EWB v1 is quite primative compared to the current version - lacking things like searching across files!

Okay, found some - it is related to "DOM" processing as the DOM is all nodes. I've stripped the irrelevant parts:

procedure TfrmClicker.ParseQuestionXML(szXML : String);
   respDoc: TDocument;
   xDataNodeList : TNodeList;
// snip
//   szXML := '<a><b><c><username>testuser</username></c></b></a>';
   respDoc := getDOMfromXMLstring(szXML);
   xDataNodeList := respDoc.getElementsByTagName('Anonymous');
   if xDataNodeList.Length > 0 then
       szAnonymousMode := xDataNodeList[0].firstChild.nodeValue;

   xDataNodeList := respDoc.getElementsByTagName('Kind');
   if xDataNodeList.Length > 0 then
       szKind := xDataNodeList[0].firstChild.nodeValue;

       xDataNodeList := respDoc.getElementsByTagName('Title');
       if xDataNodeList.Length > 0 then
           pnlMain.Caption := frmJoin123.ApplicationTitle + ': "' + xDataNodeList[0].firstChild.nodeValue + '"';
       xDataNodeList := respDoc.getElementsByTagName('Body');
       if xDataNodeList.Length > 0 then
           if xDataNodeList[0].firstChild <> nil then
               szContent := StripCodes(xDataNodeList[0].firstChild.nodeValue);
       xDataNodeList := respDoc.getElementsByTagName('EmptyBody'); // ensure there is no content

Now, that shows how to parse the XML. My understanding is that RSS can be badly formed, or inconsistent, but that's for you to sort out...
Also note that there is a new JSON RSS system that is being adopted. https://jsonfeed.org/version/1


Matthew Jones
Wed, Oct 25 2017 12:07 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.


Email timyoung@elevatesoft.com


<< Is it possible to display RSS feeds in EWB? >>

Sure, this is the function that you want to use to get the XML into a TDocument instance that contains a DOM tree of nodes that you can use to navigate and display the various bits of information as you wish:


Tim Young
Elevate Software