in reply to DBMS<=>XML
But from the sound of what you've said, what you need is a templating system more than an XML querying system. Here's an example that produces output in the same format as your submission from multiple rows returned from a database query. The script is fully functional except for the missing DBI connection params.
#!perl -w use strict; use DBI; use HTML::Template; my $query = <<''; SELECT tID,tBID,name FROM taxon WHERE sessionID=1 AND name<>'baz' my $template = <<''; <submission><tmpl_loop results> <taxa tBID="<tmpl_var tBID>"> <taxon tID="<tmpl_var tID>"> <name><tmpl_var name></name> </taxon> </taxa></tmpl_loop> </submission> my $dbh = DBI->connect( ... ); my $results = $dbh->selectall_arrayref($query,{Slice=>{}}); my $tmpl = HTML::Template->new ( scalarref => \$template , die_on_bad_params => 0 ); $tmpl->param( results => $results ); print $tmpl->output; __END__
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: DBMS<=>XML
by rvosa (Curate) on May 05, 2004 at 07:34 UTC |