Chat Threads > Rankings Forum

Live Rankings/Scoring (Research)

<< < (2/8) > >>

Slasher1985:

--- Quote from: masterclass on May 13, 2013, 05:20:04 AM ---Ideally, one would be able to pass in the proper parameters into the query string to restrict the data returned from the server to what you want.
But if that's not possible, then another way to do that would be using xpath to filter the XML data as it is returned.
Do you know how to do that?

Respectfully,
masterclass

--- End quote ---

Well, I'm going to do this in the same manner as I do with the live scoring of ATP and Challenger events.

First, I restrict the portion of the file I need (the tournament currently being updated).
I search for completed matches played in singles.
I determine the winning player, losing player and the score.
All this is done by "scratching" the XML file (I notice the key tags and extract the data from them). VBA from Excel does not really have high level functions like xpath, but I can do this the hard way just as well.

Now will come the part on which I will use the already constructed draw to determine the round (because the ITF does not provide the round in this live stream).
After that, I write the match result into a common file (also used by the ATP and Challenger events).
When the specific Futures tournament is updated, it looks into the common file, notes the result and updates the excel file.

This is notably simple on my part. I think it would be a little harder for Scott to make this in a viable live scoring feature for the main site. I'm certain he'd be interested in this, if he notices this thread.

Slasher1985:
How about this.

I've managed to repair the XML tree and now I can see it without error:

http://scores.itftennis.com/feed.php?type=days&from=1368366681000&to=1368453081000&key=a017c9d5e6d127b073e6db56fb5f0be7&language=en&config=9651&bookid=8640&mc=3

masterclass:

--- Quote from: Slasher1985 on May 13, 2013, 05:53:15 AM ---How about this.

I've managed to repair the XML tree and now I can see it without error:

http://scores.itftennis.com/feed.php?type=days&from=1368366681000&to=1368453081000&key=a017c9d5e6d127b073e6db56fb5f0be7&language=en&config=9651&bookid=8640&mc=3

--- End quote ---


:) Yep, I had already seen that by removing the 'c=2' the xml was properly formatted.  Sorry, I should have mentioned that to you. But I see you got it anyway...

Respectfully,
masterclass

masterclass:

--- Quote from: Slasher1985 on May 13, 2013, 05:35:22 AM ---
--- Quote from: masterclass on May 13, 2013, 05:20:04 AM ---Ideally, one would be able to pass in the proper parameters into the query string to restrict the data returned from the server to what you want.
But if that's not possible, then another way to do that would be using xpath to filter the XML data as it is returned.
Do you know how to do that?

Respectfully,
masterclass

--- End quote ---

Well, I'm going to do this in the same manner as I do with the live scoring of ATP and Challenger events.

First, I restrict the portion of the file I need (the tournament currently being updated).
I search for completed matches played in singles.
I determine the winning player, losing player and the score.
All this is done by "scratching" the XML file (I notice the key tags and extract the data from them). VBA from Excel does not really have high level functions like xpath, but I can do this the hard way just as well.

Now will come the part on which I will use the already constructed draw to determine the round (because the ITF does not provide the round in this live stream).
After that, I write the match result into a common file (also used by the ATP and Challenger events).
When the specific Futures tournament is updated, it looks into the common file, notes the result and updates the excel file.

This is notably simple on my part. I think it would be a little harder for Scott to make this in a viable live scoring feature for the main site. I'm certain he'd be interested in this, if he notices this thread.

--- End quote ---

Ok, I know there is a  direct FILTERXML(xml, xpath) in Excel, but it looks like you are using VBA to extract the data, manipulate it, combining with draw, and then writing to a common file, and then use that file to update data in an Excel file.

So I think VBA also has xpath functions to deal with XML that might make your job a bit easier.
Using something like:

--- Code: ---' Some dim statements'

Dim xml As MSXML2.DOMDocument60
Dim nodes As MSXML2.IXMLDOMNodeList
Dim node As MSXML2.IXMLDOMNode

'Get the xml from the url'
'set xml from the response code'

'Get the specific xml you need'

Set nodes = xml.SelectNodes(xpath expression)

'Loop through the nodes returned and extract specific data'

For Each node In nodes   
        Debug.Print node.SelectSingleNode(nodeElementname).Text
       ' or use  xmlText(node.SelectSingleNode("nodeElementName")) and set it to a value
Next node

--- End code ---

Of course the actual code would be more than that to extract all the data you need

Respectfully,
masterclass

Slasher1985:
This has come really useful, General. Yet I have reached another complication. The public key the site uses changes from time to time. I have a problem automatically identifying the new key now.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version