Just got VS2008 Beta 2 Installed so now it’s time for some LINQ to XML action.
These are the top 3 places you should go to get started:
1) MSDN Linq Project: http://msdn2.microsoft.com/en-us/netframework/aa904594.aspx
2) MyVBProf: http://www.myvbprof.com/2007_Version/VB9_XML.aspx
I don’t think I could have gotten started without the MyVBProf tutorial so I highly recommend that one. The most importing thing that helped me very quickly was to import to XML schema. Here’s the MSDN item that describes how to enable this intellisense: http://msdn2.microsoft.com/en-us/library/bb531325(VS.90).aspx.
Once you got that Intellisense, writing Linq queries starts to be fun.
From the XML above I wanted to get a list of activitites. For each of the activities, I wanted:
- StartTime (of the first lap)
- Longitude (of the first trackpoint recorded)
- Latitude (of the first trackpoint recorded)
As you can tell, the Intellisense really helps creating quickly some nicely readable queries. .Take and .Skip also made my life easier and then of course there’s the anonymous types (ID = …, StartTime =…) which also make VB coding more dynamic than ever 🙂
Now I got this little sample going, I can start some real work. These are some tasks I have in mind:
– Creating a seperate XML file with just the top level information about the rides
– Creating a file with a representative collection of points per track. Feeding thousands of points to a Virtual Earth Map doesn’t make any sense
– Creating some routines to clean up the data. Sometimes the device records some abnormal data I need to filter out. Also, I want to for instance see the average speed with and without breaks.
After that, I can start writing some UI. That will be interesting too. In the meantime I’ll try to post on some of the Linq work I’ll be doing.