Parsing XML with Golang
Unmarshal XML with golang
Learning to Unmarshal XML with golang was not something I have done before. Unmarshalling JSon is a more common tasking as XML seems to have lost some of its luster of late if it ever really had any. I was never a fan of XML so when most of the new work seemed to shift toward Json I was pretty much all for it.
Florida Lottery
In my latest project, I have a task to retrieve the Florida Lottery Winning Numbers. I used to work there a few years back as a Java Contractor so I am somewhat familiar with how their website and data presentation works. The actual games are a completely different operation. The website offers data and game information in a colorful and fairly respectable UI. I would have preferred the Lottery offered an API to access the data I needed but I was pretty sure they never got around to it and did not look very hard to see if it was available.
The Issue
The issue I had to deal with that took up so much time was acknowledging that I had to create the proper golang structs to contain the Lottery XML elements. Originally I had hoped to be able to just scan the XML, pick out the item tags and collect those into an array for subsequent processing. After an unsuccessful try of that, I had to reconcile myself to creating the full…