A few years ago, I joined a project involving Java and XML. As is observed in many cases, the situation was a mess. The team had to process two XML files – one in each module – and the task was given to two different people. As it happened, there were a lot of issues in the code developed by one person, while the code developed by the other guy did not have any problems. And this was phase one of the project.
Due to code delivery dates, it lead to a lot of arguments and lead to a situation where people got divided into teams based on their state of origin!!!
In phase two, we had to process even more complicated XML documents and I knew that the solutions used in phase 1 were not going to work, as the whole thing had been turned into a big ego issue. Hence I asked my colleagues from other projects. One of the guys suggested that I use Apache XMLBeans.
I studied Apache XMLBeans, wrote sample code to read a part of the XML from phase 2 and handed the code piece to the team who was implementing phase 2.
By using XMLBeans, we did not face a single issue of ‘XML not parsed’ correctly. All the issues that we faced, were due to logical errors and incorrect understanding of the business logic, rather than of incorrectly parsing the XML.