View Single Post
  #22   Spotlight this post!  
Unread 31-10-2009, 11:25
Andrew Schreiber Andrew Schreiber is offline
Joining the 900 Meme Team
FRC #0079
 
Join Date: Jan 2005
Rookie Year: 2000
Location: Misplaced Michigander
Posts: 4,077
Andrew Schreiber has a reputation beyond reputeAndrew Schreiber has a reputation beyond reputeAndrew Schreiber has a reputation beyond reputeAndrew Schreiber has a reputation beyond reputeAndrew Schreiber has a reputation beyond reputeAndrew Schreiber has a reputation beyond reputeAndrew Schreiber has a reputation beyond reputeAndrew Schreiber has a reputation beyond reputeAndrew Schreiber has a reputation beyond reputeAndrew Schreiber has a reputation beyond reputeAndrew Schreiber has a reputation beyond repute
Re: FRC Event Data in XML Format

Quote:
Originally Posted by Nibbles View Post
If their server supports it, you could turn the cache down to one or two minutes and send an If-Modified-Since header, in which case the server will tell you if nothing has changed and not send a response. In addition, for games in years past, why not increase the cache to an hour or even a day? The score probably won't change.

A few notes on syntax, looking at /2009/Greater Toronto/awards:
Spaces are not allowed in tag names - it is parsed as an attribute without a value. There is a leading nonbreaking space (&nbsp in many of the tag values (Home town, name, team).   is not a predefined entity, you will need a DTD declaration if you want to define it. Or just replace them with a standard space. It looks like FIRST doesn't use any entity other than  , but you will need to be careful if in the future they do, that has to get parsed correctly. The ampersands need to be escaped, too, into "&" .

As for URL parsing, are you using a regular expression?
Code:
(/(\d{4}))?(/(.+))(/(qualification|elimination))?(/(awards|schedule|rankings|results))(/(json|xml|human))?
After matching, you would have $2 as year, $4 as event, $6 as qualification/elimination, $8 as awards/etc, $10 as json/etc (if that makes any sense).
URL Parsing has been fixed, I ended up basically splitting the string apart at the "/" character and then looping through them. For everything except Event I have a lookup table and if it is in there it marks it as such and then moves to the next one. This allows it to work like /2009/Greater Toronto/XML/Schedule/Qualification or /2009/Greater Toronto/Qualification/Schedule/XML

I will get to doing the escaping stuff today, I'll replace the spaces in the tag name with a _ and pull out the   characters. I will also take care of ampersand and quotes while I am at it.

Thanks for your comments.
__________________




.
Reply With Quote