Supporting an Evolving XML Schema

The problem is supporting an XML schema that evolves over time. This is closely related to the issue of supporting an evolving API since in our scenario the XML comes from serializing C# objects.

The issue is that there is a large amount of XML in the old format and we want to support this XML with the new version of the software. We could support this using an import script but I want to show you a more general solution.

The idea is to map the old XML schema to the new XML schema using a mapping function. The below diagram illustrates this idea.

The mapping function is responsible for intelligently converting between the two XML schema versions. The below diagram illustrates a mapping function.

Using the idea of making the mapping function responsible for importing and exporting to old XML versions, our software is free’d from the task of importing and exporting to different XML versions. I believe this makes the software cleaner and easier to understand. A big win is in the case of serializing objects, we can use one serializer for each object instead of having a different serializer for each XML version we need to serialize to.

Thanks to Robert Zych for our discussion.