in reply to DBMS<=>XML

DBD::AnyData uses XML::Twig to create and query XML data sources but it doesn't handle all forms of nested tags so may or may not be of use to you.

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
    Hey, thanks for that. Yup, I think it'll have to be something like this, though this limits me to only certain types of queries.