How to parse an RSS feed using JavaScript in QuarkXPress (JQuery example)

Discuss scripting using AppleScript in QuarkXPress 2015, 2016, 2017 & 2018.
Discuss scripting using JavaScript in QuarkXPress 2018.
Post Reply
User avatar
Sarbjit Singh
Posts: 421
Joined: 22 Jan 2009, 04:44
Location: India

How to parse an RSS feed using JavaScript in QuarkXPress (JQuery example)

Post by Sarbjit Singh » 23 Jul 2018, 01:47

This is our first example that uses the JQuery library to read an RSS feed. It logs the results in the JavaScript Debugger Palette's console.

The intent is to show how you can use any web resource using native JavaScript, or a third party JS library. You may extend this example further to populate text boxes on a layout, with content fetched from the RSS feed. We are using the Quark Forum RSS in this example. However, you may use any RSS URL and change the appropriate tags that you need to read from the feed.

Feel free to ask questions.

Here is the code example with detailed comments:

You may download the snippet here:
OR here:

//Import jQuery Library from the CDN, you don't even need to download it!

(function () {

//Specify the RSS Feed Link
const rssFeed = "";
//Check the feed to know which Tag is used for each entry, specify the correct Tag here
const rssPostTag = "entry";
//Create an array of Article Tags you want to fetch from the feed
const keysToRead = ["title", "author", "id"];

//Call the function to read the feed

//*****************====================================Functions used in the JavaScript===============================****************//

function readRSS() {
let articleList = []; //Create an array to store articles
let article; //variable to store each article
let promise = new Promise(function (resolve, reject)//promise is used to ensure this task completes and returns a promise followed by further execution
//Load the RSS Feed XML using JQuery's "get" method
$.get(rssFeed, function (data) {
//Parse all the "entries" in XML
$(data).find(rssPostTag).each(function () {
var el = $(this);
//Create an object to store articles
article = new Object();
//Loop through all the required Tags and store them in the object
for (let i = 0; i < keysToRead.length; i++) {
article[keysToRead] = el.find(keysToRead).text();

//Push to the list
//Print the Element on the JavaScript Debugger console

console.log("Found " + articleList.length + " articles in the feed.");

// resolve(articleList);
return promise;

Last edited by Sarbjit Singh on 23 Jul 2018, 05:15, edited 1 time in total.

Matthias Guenther (Quark)
Posts: 2490
Joined: 04 Jun 2004, 15:06

Re: How to parse an RSS feed using JavaScript in QuarkXPress (JQuery example)

Post by Matthias Guenther (Quark) » 23 Jul 2018, 04:42

Great script, Sarbjit.

And congratulations to your 400th posts, despite Facebook taking over ;-)

Feel there should be more chatting, more tips, more user interaction?
Join us on Facebook, a forum-like group with over 2,000 QuarkXPress fans interacting:


Post Reply

Return to “QuarkXPress 20xx: Scripting (AppleScript / JavaScript)”