Fusebox and Frameworks Conference

Untitled

Taming Framework XML files with XSLT and XDoclet

  • "Taming Framework XML files with XSLT and XDoclet" interview with John Paul Ashenfelter
  • ********************************************************************
  • Michael Smith:This time we are talking with John Paul Ashenfelter about his Fusebox and Frameworks-05 talk "Taming Framework XML files with XSLT and XDoclet". So why should a developer come to your session John Paul ?
  • John Paul Ashenfelter: One common feature of Fusebox, Mach-II, and just about every other framework in the ColdFusion (and Java) world is XML configuration files. Fusebox 4 has it's circuit.xml, the Mach-II folks have the mach-ii.xml file, and in the Java world, Struts developers have been dealing with struts- config.xml for years. CFML has began supporting XML with the advent of CFMX, but there are many other tools and libraries that have been developed by the Java community to simplify dealing with XML files that have direct applications to many of the ColdFusion frameworks.
  • MS: What tools?
  • JPA: For starters, the open source XML and XSLT engines from Apache -- Xerces and Xalan (which incidentally are both under the hood in CFMX). For example, I've used XSLT on FLiP-oriented projects to convert the FreeMind's XML-based mindmaps into the appropriate fusebox.xml and circuit.xml boilerplate.

  • MS: That is cool - BTW do you get access to more power with Xerces and Xalan when used directly rather than inside CFMX?
  • JPA: You certainly do get a lot more capabilities, though at a corresponding increase in the complexity of your code. For example, using Xalan you can explicitly choose different kinds of transformers to process streaming XML, SAX events, or DOM objects directly using XSLT. This doesn't matter for most applications, but for the folks that need to access to this capability, there's simply no substitute.
  • MS: Cool. Any other tools?
  • JPA: And for developers who are lazy, err, pragmatic, the Xdoclet project can be used to provide a developer's framework for metaprogramming the various frameworks
  • MS: metaprogramming?
  • JPA: Metaprogramming is writing programs that in turn, generate other programs. J2EE developers really spent a lot of energy building tools to helpmanage the overhead of the multiple files required to implement and deploy Enterprise JavaBeans (EJBs), which is a task the Xdoclet excels at. But there's no conceptual difference between using XDoclet to generate an J2EE web.xml deployment descriptor and a mach-ii.xml file, it just takes some custom coding. More importantly, XDoclet runs as part of an Apache Ant build script, so generating these configuration files becomes a dynamic part of the build-and- deploy process -- which means that builds become automatic and repeatable.

  • MS: So does this save any time or have other benefits in practice?

  • JPA: Definitely! The capability to reliably and repeatably build and deploy your application is an enormous time-saver. Knowing that you can get *exactly* the same build every time immediately improves the reliability of your code. Furthermore, using XML-oriented tools to customize the build for various platforms makes deployments much less risky since you *know* what you'll get every time -- no manual settings to forget. And imagine having one XML-based configuration for your business objects and being able to generate the appropriate CFC objects for Mach-II, Fusebox, or even Java POJOs (plain-old java objects) to speed your development -- you can have a Fusebox public site and a MachII administrative site that both share a common set of business objects if you've got some XSLT chops!
  • MS: Wow - I will look forward to seeing your talk!

Taming Framework XML files with XSLT and XDoclet


If you have any questions, contact michael(at)teratech.com


|  HOME  |  DIRECTIONS  |  HOTEL  |
|  TOPICS  |  SPEAKERS  |  REGISTER  |  CF CONF CENTRAL  |