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

thomh

Hi,

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);
var
   respDoc: TDocument;
   xDataNodeList : TNodeList;
// snip
begin
   try
//   szXML := '<a><b><c><username>testuser</username></c></b></a>';
   respDoc := getDOMfromXMLstring(szXML);
   xDataNodeList := respDoc.getElementsByTagName('Anonymous');
   if xDataNodeList.Length > 0 then
   begin
       szAnonymousMode := xDataNodeList[0].firstChild.nodeValue;
   end;

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

       xDataNodeList := respDoc.getElementsByTagName('Title');
       if xDataNodeList.Length > 0 then
       begin
           pnlMain.Caption := frmJoin123.ApplicationTitle + ': "' + xDataNodeList[0].firstChild.nodeValue + '"';
       end;
   end;
       xDataNodeList := respDoc.getElementsByTagName('Body');
       if xDataNodeList.Length > 0 then
       begin
           if xDataNodeList[0].firstChild <> nil then
               szContent := StripCodes(xDataNodeList[0].firstChild.nodeValue);
       end;
       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.

Avatar

Email timyoung@elevatesoft.com

Thom,

<< 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:

https://www.elevatesoft.com/manual?action=viewtopic&id=ewb2&topic=ParseXML

Tim Young
Elevate Software
www.elevatesoft.com
Image