Wednesday, December 7, 2011

XML Transformation - Use XSD please...

Whenever organizations share data in XML format they may end up taking the following steps to process the data:
1)      Transform XML to an internal standard
2)      Process the transformed data
Please note that the data sharing strategies, processes and complexity can vary significantly from one organization to another. Therefore, the steps outlined above may not cover all scenarios. Here, I’m just trying to highlight a simple XML driven data exchange scenario.

Sometimes I have heard people say “It’s only a simple XML, why do I need XSD? I can quickly throw an XSLT file and get done with.” I cringe when I hear something like this. Why?? In my opinion, it solves the short term problem; but long term impact could be nightmarish. Please use XSD and don’t rely on XML no matter how small the task is.

XSD or XML Schema Definition is an XML-based language used to define and control XML content. XSD essentially serves as a data sharing contract between the involved parties. Once the contract is defined, the involved parties can agree upon several appropriate steps should one of the parties break the data exchange contract. One can reject the data or automatically notify the right individuals to correct the issue. Now, if we decide not to use XSD, then the sender can change the content of XML as they see fit. In turn, the transformation process can break forcing the receiver to alter the transformation scripts from time to time. Maintenance can become nightmarish.
If XSD is used, all parties definitely reserve the right to request a change; however, it forces them to follow a process. One party is less likely to randomly alter XML contents without informing the other party. If we simply rely on XML, trading partners can change contents without notifying the other. As a result, issues may pop-up very late in the game forcing someone to fight the fire in a hurry. So, please use XSD no matter how trivial the XML transformation.

No comments:

Post a Comment