One of the inherent challenges that comes with data is that, once its structure has been defined, it can never be changed. Ever. Data structures are literally chiseled in stone, and the only way to use something different is to rewrite your application from scratch and throw the old application (and any server it touched) in the fires of Mount Doom.

This was actually one of the primary reasons XML was invented. At its core, it’s just one big ole’ human-readable string that’s flexible enough to define any data or specification… even the sacred XML spec itself. Of course, for all of its glory, XML still suffers from a fundamental problem with data: you have to know the data’s structure before you starting working with it. That means analysis, modeling, data dictionaries, and all sorts of other booooooring things that involve not writing code.

Fortunately, the crack engineers at Dave Watson's developed a solution around this problem. Instead of using XML to define specific data structures, they’d use it to define generic data structures. This way, they could use XML to define anything!

<?xml version="1.0" encoding="UTF-8"?> 
<record 
  dbKey="9035768" 
  name="loanPackage" 
  id="1002210" 
  description="loanPackage for loan #9035768" 
  xml="PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4NCjxyZ
       WNvcmQ+DQogIDxkYktleT45MDM1NzY4PC9kYktleT4NCiAgPGJvcnJvd2
       VyMT4NCiAgICA8Zmlyc3Q+SmVubmlmZXI8L2ZpcnN0Pg0KICAgIDxsYXN
       0Pkdhcm5lcjwvbGFzdD4NCiAgICA8YWRkcmVzcz40ODI5IE9ha3ZpZXcg
       TGFuZTwvYWRkcmVzcz4NCiAgICA8Y2l0eT5QZXJyeXZpZXc8L2NpdHk+D
       QogICAgPHN0YXRlPldBPC9zdGF0ZT4NCiAgICA8c3NuPjIwOS0yMy02OD
       c0PC9zc24+DQogIDwvYm9ycm93ZXIxPg0KPC9yZWNvcmQ+DQoNCg=="
/>

Obviously, the generic structures needed some sort of specific structuring, and that's where XML came in. Again. Base-64 decode the xml element, and you're left with the following.

<?xml version="1.0" encoding="UTF-8"?>
<record>
  <dbKey>9035768</dbKey>
  <borrower1>
    <first>Jennifer</first>
    <last>Garner</last>
    <address>4829 Oakview Lane</address>
    <city>Perryview</city>
    <state>WA</state>
    <ssn>209-23-6874</ssn>
  </borrower1>
</record>

After discovering this brilliant solution, Dave wasn't sure what was more brilliant: the fact that someone on his team thought of the design, or the fact that an XSLT-based Base64 Decoder had already been written.

[Advertisement] BuildMaster allows you to create a self-service release management platform that allows different teams to manage their applications. Explore how!