This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I have been given the task of generating XML documents by extracting data from a database and then structuring it as needed and then outputing XML. The XML produced is completely determined by a configuration file.
I didn't find much information on the web about this, but it seems to me that the best approach is to use DOM to build the data structure and then transform it using XSLT.
The advantages would be: standard DOM API to build datastructure makes for better maintainability. easily enrich the datastructure by adding more elements, etc. use standard XSLT to transform the data into the desired output format. have the rich language of XSL to transform the data.
The disadvantage would basiclly be speed, since XSLT is not particularly fast, but since XSLT technology will improve over time especially with XSLT compilers, this disadvantage will probably become smaller and smaller.
I would be really interested in any comments on this approach or any alternative suggestions or technologies I can use. Also what would be the most efficient XSLT transformer to use and what would be the best toolkit for performing XPaths directly on a DOM structure. e.g. a tool that can do something like.
The origonal idea was to build our own data structures, and build our own expressions to allow us to access the data structure in the configuration, but this would be quite hard to do properly, and would not have the expressive power of XPATH. The advantage of doing this ourselves then would be speed, but it would probably require a lot more work.