When the XML revolution happened, I was surprised how quickly developers
jumped on to the coming tide. I have to admit, the first time I saw XML, I
believed it was nothing more than just structured storage. That is the magic of
it, isn't it. It is just structured storage, but a structured storage
format that is universally understood.
So I think we have reached a crossroads with XML. The toolsets have
made it so easy to use that I think there is a bit of overuse of XML.
Afterall, XML is just structured storage, but it is inefficient structured
storage. When we use XML we are giving up performance and efficiency for
the portability of the format and the richness of tools to work with it (the
tangential technologies of XPath, XSLT, SOAP, etc.). I like to think of
XML as a way to enable enterprises to speak with each other in a common
way. With that in mind, are we not (as developers) overusing XML? I
think so.
How does this affect my daily work? I have come to realize that there
has to be a better way of dealing with XML to improve the speed of development
and simplify code that uses it. Using SAX or a DOM model to navigate XML
documents creates spagetti code of weakly typed code. There has to be a
better way of marrying portability of XML with a simplier (preferrably strongly
typed) way of programming against XML. Luckily for those of us using .NET,
the Framework's XmlSerializer class is a really useful tool in that it can allow
us to use a set of classes as an object graph and only deal with the
complexities and inefficiency of XML when we actually serialize it to an XML
Document. See http://msdn.microsoft.com for more information on how to
use XmlSerializer.
For those who do not know yet, the XML integration with the DataSet is very
powerful. Most of the integration is about filling and getting XML from your
DataSet. But the XmlDataDocument is really cool. Simply by assigning the DataSet
to the XmlDataDocument, you can work with the DataSet data either relationally
(through the DataSet) or hierarchically (through the XmlDocument). So, next time
you need to transform the DataSet data or just run an XPath query, assign your
DataSet to an XmlDataDocument and watch the magic begin...