Announcing SharpGpx

One of the major features of TrueNorth is data interoperability, and one of the most common file formats for exchanging GPS data is GPX. GPX is supported by many smart phones, GPS devices, and hundreds of software packages. So, one of the earliest features added to TrueNorth was GPX support.

GPX is an XML File format, and the two versions in existence have well-defined Xml Schemas (XSDs). In addition, they are very simple. This made writing the library very simple through the use of  XsdToClasses; using the tool, the code to validate, read and write the files was generated; about 3800 lines of code, in a few seconds.

Additional work on adding support for Garmin GPX Extensions, loading and saving from streams, files, and strings, and little polish with some helper methods, and the library was finished.

Today, BlueToque software would like to announce that the GPX library, SharpGpx, is being published as open source on CodePlex, and is available for immediate download to the public.

Serializable base class added to XSDToClasses project

At the prompting (or complaint) of a reader, I’ve shared a base class that I use with my code generator.

The generated code is “pure” in that it doesn’t contain any methods that don’t have to do with the data — it doesn’t implement saving and loading methods. I could create a codemodifier for this, but it could just cause trouble. However, this leaves users writing the saving and loading code over and over, and we can’t have that.

An XSD can express inheritance. Generating save and load methods for every class would cause lots of warnings and duplicated code. So I’ve created a generic base class that contains a bunch of utility methods including the save and load methods. If you want to have these in a class, just inherit the partial class from this base class and you’re ready to go.

There is an example project that shows you how to use it. There’s also a nifty serializable color class. It’s not going to work in every circumstance (for example if  your class is already inheriting), but it should reduce the amount of code you need to write.

You can find the download at google code  here.

XsdToClasses Open Sourced

The XsdToClasses tools, which I’ve been using for most of my software development for many years, has been published as open source at Google Code. The license is the GPL V3; note that since the XsdToClasses tool is a code generator, the tool itself is GPL, but the code it generates is most definitely not; the output from the program can be under any license you like.

I use this tool so much, and it has saved me many hours of development time over many years. May it serve you well also.

Follow

Get every new post delivered to your Inbox.