Determining the Output Format

Once all the data has been stored in a convenient data structure, you will need to write it out as XML. The first step in this process is deciding what the XML should look like. XML does offer the possibility of a much more hierarchical structure than is available in the flat format. For example, you might sort budgets by department and year. You might use the natural hierarchy of the government in which agencies contain bureaus, bureaus contain accounts, and accounts contain subfunctions. I'll demonstrate several possibilities, beginning with the simplest, a fairly flat XML representation that stays very close to the original flat format.

As published the data is essentially one table. Thus the simplest output format ...

Get Processing XML with Java™: A Guide to SAX, DOM, JDOM, JAXP, and TrAX now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.