Retrieve RSS Feed

Author Message
GoingForGold

  • Total Posts : 3
  • Scores: 0
  • Reward points : 0
  • Joined: 11/22/2011
  • Status: offline
Retrieve RSS Feed Tuesday, November 22, 2011 9:57 AM (permalink)
0
Hello all together!
 
I have been searching the internet and trying various things all day but nothing worked so far. I hope you can help me :)
 
My goal is to retrieve an RSS Feed (an XML file located in the world wide web) and find all the "title" fields and put them together in one string variable (in a .vbs document).
 
I tried several things, including jsrssv.ops, nothing worked, not even the testscripts ;). I would be very happy if you could give me some help for this project!
 
Thank you!
 
#1
    59cobalt

    • Total Posts : 979
    • Scores: 91
    • Reward points : 0
    • Joined: 7/17/2011
    • Status: offline
    Re:Retrieve RSS Feed Tuesday, November 22, 2011 12:01 PM (permalink)
    0
    You could use an XMLHTTP request to retrieve the feed, and then load it into an XMLDOM document.
     
    #2
      TNO

      • Total Posts : 2094
      • Scores: 36
      • Reward points : 0
      • Joined: 12/18/2004
      • Location: Earth
      • Status: offline
      Re:Retrieve RSS Feed Tuesday, November 22, 2011 2:31 PM (permalink)
      0
      GoingForGold


      Hello all together!

      I have been searching the internet and trying various things all day but nothing worked so far. I hope you can help me :)

      My goal is to retrieve an RSS Feed (an XML file located in the world wide web) and find all the "title" fields and put them together in one string variable (in a .vbs document).

      I tried several things, including jsrssv.ops, nothing worked, not even the testscripts ;). I would be very happy if you could give me some help for this project!

      Thank you!

       
       Dim titles : titles = ""
      
      Dim xml : Set xml = CreateObject("MsXml2.DomDocument.6.0")
      With xml
       .async = False
       .load("http://www.visualbasicscript.com/rss-m95005.ashx")
       Dim node
       For Each node In .selectNodes("//title")
       titles = titles & ";" & node.text
       Next
      End With
      
      MsgBox titles
      

      To iterate is human, to recurse divine. -- L. Peter Deutsch
       
      #3
        GoingForGold

        • Total Posts : 3
        • Scores: 0
        • Reward points : 0
        • Joined: 11/22/2011
        • Status: offline
        Re:Retrieve RSS Feed Tuesday, November 22, 2011 10:27 PM (permalink)
        0
        Thank you for your ideas, and thank you for this snippet TNO. I tried something in this direction which didn't work, but now i tried your code. Well, are you sure with these ":"? I have never seen this thing in a .vbs code and I also get an error message because of these ":".
         
        #4
          TNO

          • Total Posts : 2094
          • Scores: 36
          • Reward points : 0
          • Joined: 12/18/2004
          • Location: Earth
          • Status: offline
          Re:Retrieve RSS Feed Wednesday, November 23, 2011 3:37 AM (permalink)
          0
          GoingForGold


          Thank you for your ideas, and thank you for this snippet TNO. I tried something in this direction which didn't work, but now i tried your code. Well, are you sure with these ":"? I have never seen this thing in a .vbs code and I also get an error message because of these ":".

           
          You know you can do the following:
           
          Dim foo
          foo = "bar"
           
          The ":" symbol is used so you can simply put them on the same line:
           
          Dim foo : foo = "bar"
           
          If you are getting an error then something else is going on. What error  message are you getting?
          To iterate is human, to recurse divine. -- L. Peter Deutsch
           
          #5
            GoingForGold

            • Total Posts : 3
            • Scores: 0
            • Reward points : 0
            • Joined: 11/22/2011
            • Status: offline
            Re:Retrieve RSS Feed Wednesday, November 23, 2011 4:09 AM (permalink)
            0
            Well i have a german OS so I'm not sure if an english OS will translate it the same as me ;)

            row: 1
            character: 13
            error: invalid character
             
            Edit: Like you, i found this a little strange. i wrote your script new (probably some character messed up) and now it works. perfect, thank you!
             
            Edit2: i have never worked with "With" functions. is there a decent way to just "loop" it say 5 times?
            <message edited by GoingForGold on Wednesday, November 23, 2011 4:36 AM>
             
            #6
              TNO

              • Total Posts : 2094
              • Scores: 36
              • Reward points : 0
              • Joined: 12/18/2004
              • Location: Earth
              • Status: offline
              Re:Retrieve RSS Feed Wednesday, November 23, 2011 5:36 AM (permalink)
              0
              GoingForGold

              Edit2: i have never worked with "With" functions. is there a decent way to just "loop" it say 5 times?

              In other words you just want the first 5 entries instead of all of the entries?
               
              There is no need to use a loop for this as XPath has something like this built in:
              
              .selectNodes("//title[position() <= 5]")
               
              To iterate is human, to recurse divine. -- L. Peter Deutsch
               
              #7

                Online Bookmarks Sharing: Share/Bookmark

                Jump to:

                Current active users

                There are 0 members and 1 guests.

                Icon Legend and Permission

                • New Messages
                • No New Messages
                • Hot Topic w/ New Messages
                • Hot Topic w/o New Messages
                • Locked w/ New Messages
                • Locked w/o New Messages
                • Read Message
                • Post New Thread
                • Reply to message
                • Post New Poll
                • Submit Vote
                • Post reward post
                • Delete my own posts
                • Delete my own threads
                • Rate post

                2000-2012 ASPPlayground.NET Forum Version 3.9