Issues when making use of XML (part 2)

XML is quite common nowadays, especially in the application integration business that I am involved in. However, I still see companies making big mistakes when they decide to start using XML (for example as the exchange format with their business partners). This series of posts is about mistakes (or at least clumsiness) in using XML that I noticed during several projects.

Only change the syntax of the CSV file (no normalization)

With this I mean that there has been existing interfaces based on character separated values like:

car-height|car-width|driver-name|driver-gender

And when they start to use XML they change it to:

1
2
3
4
5
6
<row>
  <car-height>xxx</car-height>
  <car-width>xxx</car-width>
  <driver-name>xxx</driver-name>
  <driver-gender>xxx</driver-gender>
</row>

More readable would be something like:

1
2
3
4
5
6
7
8
9
10
<row>
  <car>
    <height>xxx</height>
    <width>xxx</width>
  </car>
  <driver>
    <name>xxx</name>
    <gender>xxx</gender>
  </driver>
</row>

The fields concerning one entity are now grouped together, like you would do when normalize a relational database. This not only increases human readability but it also increases the chance to get to a reusable schema. With this latest example you can imagine that you can use the ‘car’ element also in another scheme.
So the tip of the day is: perform normalization in your XSD where possible.

tags:

About Pascal Alma

Pascal started as an Oracle Developer in 1997 and developed numerous applications with Oracle Designer/Developer and PL/SQL. Since 2001 Pascal becomes more and more active with the development of software at the Java/J2EE platform. Nowadays Pascal is a senior JEE Developer/ Architect and has a lot of experience with several open source initiatives/ frameworks especially within the Enterprise Integration area. Besides these technical skills Pascal is a big Scrum enthusiastic.

Comments are closed.