The XML Serializer built into the .Net framework is a pretty cool side-utility when working with anything that consumes XML. A few years ago I posted about how your should Make your XML strongly-typed: Because you can and it’s easy in which I discussed how easy and awesome it is to use the XSD.exe tool to quickly convert an XML file into a XSD and then further covnert into a Serializable c# class file. The only not-so-perfect part of using the XML Serializer is that it by default adds namespace and schema attributes that point at the W3C standard declarations – but it’s just as easy to remove these so your resulting XML looks perfectly like your original XML file.
In the modern world we live in with Web Services, RPC calls and the like, SQL server has had a lot of work on its hands trying to keep its followers from leaving to newer ways to store data such as document databases. Microsoft SQL server is like an old friend that developers have either come to love or hate – but like old friends, they may have been keeping some secrets. One of these hidden gems appears in the shape of native XML output support for queries.
Earlier in the week i posted a Twitter post commenting on how if your not using the XMLSerializer class to you advantage, well, as Scott Hanselman puts it now and then: Your doing it wrong. I use the XML Serializer classes on a daily basis to refer to my XML in a strongly typed manner and often wonder why i see people go to so much effort in creating hard to maintain code just to get data from or send it to an XML file.