Streaming live at 10am (PST)

Import XML feed into Webflow?

#1

Hello, can someone explain to me how to get an XLM feed in Webflow and then styled it? As an example a feed: http://lb.50g.nl/xml/cc4cade01cc5565c1d5efc6e7ee97ac4.xml

1 Like

#2

Hello @Erwin

I think there’s no way to import an xml feed. You need to use a CSV file. I’ve found this > https://codebeautify.org/xml-to-csv-converter maybe will work.

I tried the tool and you can see the CSV output here > https://docs.google.com/spreadsheets/d/1PR7dxozGY37b4KbKX4D7wlurw7M6WdJ9tN_b7d3-6hM/edit?usp=sharing

CSV import > https://webflow.com/feature/csv-import

Hope this helps

Piter :webflow_heart:

0 Likes

#3

Hello @PiterDimitrov

Thanks for replying! The fact that it is a web service means that it all goes automatic. All the news messages will be collected by my ‘scraper’, 24/7. This also works in my apps. If there is a automatic solution to convert xml to CSV, that will be fine. Otherwise Iet will not work. Perhaps with the help of Zapier?

1 Like

#4

Not sure if this is the right one, but as far as I know rss are in xml > https://zapier.com/apps/webflow/integrations/rss/15330/create-webflow-cms-items-from-new-rss-items

0 Likes

#5

Are you trying to import the data and create CMS entries (stored data) or do you need to just consume the XML feed and display it to a visitor on your site? The reason I ask is if it already exists somewhere else, why not just display it. You could do that with JQuery.

0 Likes

#6

Hello @webdev,

This is the plan (see sketch). How do I accomplish this in Webflow. As you see, the feed has no styling. Just plain text. So I need to do that in Webflow.

@PiterDimitrov
I’ve tried the Zapier to webflow. Zapier can’t read my xml-feed, but with a rss-feed I got some results. But if I managed this to connect to my collection, how does the publishing of these articles goes? I mean, does Webflow support ‘Autopublishing’ ?

1 Like

#7

Assuming you can load the feed via jQuery.ajax(). which I can’t because the Access-Control-Allow-Origin header is set. You could iterate over each item in the xml file, set variables with the data, append them to an element, and style the contents with a style declaration in the page custom code.

  $("#myfeed").append("<ul class='feed-items'></ul>");
  $.ajax({
    type: "GET",
    url: "data.xml",
    dataType: "xml",
    success: function(xml){
    $(xml).find('item').each(function(){
      var title = $(this).find('header').text();
      var description = $(this).find('description').text();
      var thumb = $(this).find('thumb').text();

      $("<li class='feed-item'></li>").html("<header>" + title + "</header>" + "<img src='" + thumb + "'/>" + "<div class='feed-desc'>" + description + "</div>").appendTo("#myfeed ul");

    });
  },
  error: function() {
    alert("An error occurred while processing XML file.");
  }
  });
});
`
1 Like

#8

Hello,

I think yes. Zapier description > whenever a new RSS item appears in your feed, you can automatically generate new CMS items in Webflow

You need to use CREATE LIVE ITEM. Zapier description > Create Live Item > Adds a new item to a given collection on your published site.

Check also @webdev suggestions

Piter :webflow_heart:

0 Likes

#9

Just a note:

If you’re consuming a feed, best to use RSS, so that the structure is well defined. If you are pulling some custom XML or JSON in, and you are not the source, it can change. Also if someone publishes an RSS feed, you won’t get blocked from consuming it.

0 Likes