Results 1 to 3 of 3

Thread: XML Feed

  1. #1
    Heidi is offline Member
    Join Date
    Oct 2012
    Posts
    2
    Rep Power
    0

    Default XML Feed

    I'm having a challenge with XML feed from a website.

    Hopefully someone can provide advice

    I need to gather data each day from a website.
    I am specifically interested in the 'rating' column on the far right of each page.

    This is an example of the web page
    [Moderator edit: link removed]

    And this is the xml example of the same page
    [Moderator edit: link removed]

    I need to gather multiple pages each day (into csv or excel), with the '2011/10/5/BR7' changing - there are different codes BR7 and BR8 etc, for each day -

    I beginning to learn Java, but I don't know the most efficient way to proceed.

    Is a long java code best, which automatically scrapes and saves the data into a excel file?

    Or another method?

    This is an xlm example the website offers, but i cannot get it to work. It is for excel 2003 , yet i have 2010 - is that the problem?


    XML Code:
    Sub LoadRaceField()
        
        Dim xmldoc As MSXML2.DOMDocument
       
        Set xmldoc = New MSXML2.DOMDocument
    
        xmldoc.async = False
        xmldoc.Load ("http://t...28/VR6.xml") // Moderator edit: link removed
        
        If (xmldoc.parseError.errorCode <> 0) Then
            MsgBox ("An error has occurred: " & xmldoc.parseError.reason)
        Else
            Set runnerList = xmldoc.selectNodes("//Runner")
            
            Sheet1.Cells.Clear
            
            For i = 0 To (runnerList.Length - 1)
                
                Set runner = runnerList.Item(i)
                
                Set runnerNumber = runner.Attributes.getNamedItem("RunnerNo")
                Set runnerName = runner.Attributes.getNamedItem("RunnerName")
                Set runnerWeight = runner.Attributes.getNamedItem("Weight")
                Set riderName = runner.Attributes.getNamedItem("Rider")
                            
                If Not runnerNumber Is Nothing Then
                    Sheet1.Cells(i + 1, 1) = runnerNumber.Text
                End If
                
                If Not runnerName Is Nothing Then
                    Sheet1.Cells(i + 1, 2) = runnerName.Text
                End If
                
                If Not runnerWeight Is Nothing Then
                    Sheet1.Cells(i + 1, 3) = runnerWeight.Text
                End If
                
                If Not riderName Is Nothing Then
                    Sheet1.Cells(i + 1, 4) = riderName.Text
                End If
                
            Next
        End If
        
    End Sub
    Thanks in advance.
    Last edited by DarrylBurke; 10-03-2012 at 08:24 AM. Reason: Removed spammy links

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,450
    Rep Power
    19

    Default Re: XML Feed

    This is not a beginners level task.
    If you don't know Java you are going to make a right hash of this.

    That's my first comment.

    After that, then break the task down into steps and write code for each of those steps.
    One decision you'll need to make is whether you need to whole document in order to process parts of it.
    If you can get away with only processing it via streaming then I would aim for that.
    How you process it is entirely down to what needs doing (and is not something we could possibly cover here).
    You could, for example, do some form of transformation, passing the XML stream in and an xslt which would output it straight into a csv file (which would be my choice).
    Please do not ask for code as refusal often offends.

  3. #3
    Heidi is offline Member
    Join Date
    Oct 2012
    Posts
    2
    Rep Power
    0

Similar Threads

  1. Reading RSS feed
    By jprog in forum JavaServer Pages (JSP) and JSTL
    Replies: 0
    Last Post: 02-10-2011, 11:07 AM
  2. RSS Feed help..
    By _ShivamKapoOr_ in forum New To Java
    Replies: 2
    Last Post: 09-16-2010, 02:32 PM
  3. what is web service and rss feed
    By javastuden in forum Advanced Java
    Replies: 0
    Last Post: 03-01-2010, 04:43 AM
  4. Web service and RSS feed (maybe?)
    By richiebabes in forum Advanced Java
    Replies: 6
    Last Post: 06-28-2009, 09:42 PM
  5. line feed in CSV
    By javaplus in forum New To Java
    Replies: 2
    Last Post: 01-24-2008, 03:46 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •