We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hey
I am having issues loading simple xml-feeds in p5.js. It seems like the feed never loads?
The link for the (example) xml feed is ekstrabladet.dk/rss2/?mode=normal&submode=sport. I am using the p5.js editor.
var xml;
function preload() {
var url = 'http://ekstrabladet.dk/rss2/?mode=normal&submode=sport';
xml = loadXML(url);
}
function setup() {
print(xml);
}
Answers
https://forum.Processing.org/two/discussion/20149/unable-to-load-xml-file#Item_8
http://p5js.SketchPad.cc/sp/pad/view/ro.CJr$SpnCkgIPQC/latest
Super cool, thanks a lot!
Quick follow up question: How would I save all the titles in an array? (I am not used to working with xml nor the
const item of
syntax).https://developer.Mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for...of
https://p5js.org/reference/#/p5.XML
http://p5js.ProcessingTogether.com/sp/pad/export/ro.CJr$SpnCkgIPQC/latest
I get
23391: Uncaught TypeError: undefined is not a function
for the lines containingfor (const item of xml.getChild('channel').getChildren('item'))
Any hint why? Still using the p5.js editor btw.
Which p5.js editor? AFAIK, that was abandoned a long time ago already! :-&
If you really need an offline editor for p5.js, my advice is to grab p5.js mode for Processing's IDE (PDE):
https://Processing.org/download/
Yeah, I was using the old deprecated one
https://github.com/processing/p5.js-editor
, guess its time to move on haha.Thanks a lot for your help :-)
Hey, the sketch (and your example on SketchPad: http://p5js.SketchPad.cc/sp/pad/view/ro.CJr$SpnCkgIPQC/latest) somehow stopped working even though https://ekstrabladet.dk/rss2/?mode=normal&submode=sport still spits out new headlines. Any clue why this is happening?
Sorry, but I've got no idea why it's stopped working and dunno how to fix it. :(
Although http://CORS-Anywhere.HerokuApp.com proxy CORS site is still working. #-o
And this other sketch https://CodePen.io/GoSubRoutine/pen/Qdjmrm?editors=0012 is still OK. :-?
Good news for ya @Andreas_Ref! :-bd
Just found out another CORS proxy which works for http://EkstraBladet.dk at:
https://Gist.GitHub.com/jimmywarting/ac1be6ea0297c16c477e17f8fbe51347
Here's the updated sketch: http://p5js.ProcessingTogether.com/sp/pad/export/ro.CJr$SpnCkgIPQC
Thank you so much ^:)^