Neat SAX Trick

9 PM April 7, 2003

I have a fascination with dead technologies, which explains why I started reading the Java Web Services Tutorial today. In the XSLT chapter, I came across this gem entitled “Generating XML from an Arbitrary Data Structure”.

It describes how to implement just enough of the interface of a SAX parser to drive an XSLT stylesheet. The example given transforms an LDAP database entry (in the form of an ldif file) into an XML document using the default XSLT transformation. The trick works quite well in this situation, because the ldif file has to be parsed anyway.

This kind of trick might also work in other situations where parsing and transformation are required. For example, you could build a tiny web-app that runs free-format queries against an SQL database, and returns HTML formatted table results. Using an external XSLT stylesheet would give scope for customising the display.

By alang | # | Comments (0)
(Posted to Software Development)

Comments

Add Comment




(Not displayed)






(Leave blank line between paragraphs. URLs converted to links. HTML stripped. Indented source code will be formatted with <pre> tags.)




© 2003-2006 Alan Green