Sounds good - I'll take a close look. I saw how Oracle does it and thought we could clone their approach, so I started by specing out plpgsql functions that takes a pg class, attributes and sql query and output an xml file by introspecting thru the system tables (pg_class, pg_type, pg_attribute). In the meantime - i've written some simple-minded tcl code that does a similar thing.
Thanks, Danny