How can I do simple calculations using prices from RSS feeds?

Discussion in 'Programming' started by roadrunner12, Jan 19, 2009.

  1. #1
    Hi all,

    This is probably a really simple solution for someone that knows programming languages, but unfortunately I don't lol, that's why I'm asking this...

    What I want to do is provide a current list of prices (using an RSS feed) and automatically subtract 15% from them to show users how much they would profit after listing fees.

    I have created an RSS feed of these prices in Yahoo Pipes, but now I need to know what to do with this feed so I can run a simple calculation on it.

    Any help would be appreciated, I just need to be steered in the right direction!

    Thanks :)
     
    roadrunner12, Jan 19, 2009 IP
  2. tankard

    tankard Well-Known Member

    Messages:
    1,018
    Likes Received:
    55
    Best Answers:
    0
    Trophy Points:
    185
    #2
    What is this thing that creates your feed? Is it a php file? In this case you can go with a simple JavaScript.

    For example
    
     function getprices() {
              DownloadUrl("yourxml.php", function(data) {
              var xml = xml.parse(data);
              var element = xml.documentElement.getElementsByTagName("element");
              for (var i = 0; i < element.length; i++) {
                var price = element[i].getAttribute("price");
              }}
    Code (markup):
    And then if you onload this getprices function, you should be able to get the prices and perform simple JavaScript calculations on it.

    It is only a bare idea, maybe other guys can elaborate on this. :p
     
    tankard, Jan 19, 2009 IP
  3. roadrunner12

    roadrunner12 Member

    Messages:
    129
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    30
    #3
    Hey thanks for the code!

    I'm using Yahoo Pipes. It's a mashup editor that manipulates RSS feeds. It also has the ability to take regular pages and turn them into RSS.

    I'm pretty new to it, so I'm not aware of all of it's functions yet, but you can check it out here: http://pipes.yahoo.com/pipes/
     
    roadrunner12, Jan 19, 2009 IP