+---------+--------------------+-------------+ | artist | title | album | +---------+--------------------+-------------+ | Genesis | Firth of Fifth | Seconds Out | | Genesis | I Know What I Like | Seconds Out | +---------+--------------------+-------------+ #### SELECT * FROM SONGS WHERE ARTIST='Genesis' #### Genesis Firth of Fifth Seconds Out Genesis I Know What I Like Seconds Out #### use strict; use DBIx::XML_RDB; my $xmlout = new DBIx::XML_RDB(qw(database:host driver user passwd)) || die "Failed to make new xmlout"; $xmlout->DoSql("SELECT * FROM SONGS WHERE ARTIST='Genesis'"); print $xmlout->GetData(); #### # XML::Simple my $config = XMLin($xmlout->GetData); # XML::Parser my $p1 = new XML::Parser; $p1->parse($xmlout->GetData); # XML::Twig my $t = new XML::Twig(); $t->parse($xmlout->GetData); #### my $out = $xmlout->GetData; my $css = qq||; $out =~ s/(<\?.*\?>)/$1\n$css/; # now the first three lines of $out are: #### Alias /xml/ "/usr/local/apache/xml/" AllowOverride None Options ExecCGI AddHandler cgi-script .xml DirectoryIndex index.xml Order allow,deny Allow from all #### # index.xml (a CGI script in disguise) use strict; use CGI qw(:standard); use DBIx::XML_RDB; my $xmlout = new DBIx::XML_RDB(qw(database:host driver user passwd)) || die "Failed to make new xmlout"; $xmlout->DoSql(" select artist, title, album, year from mp3.songs order by artist,year "); my $out = $xmlout->GetData; my $xsl = qq||; $out =~ s/^(<\?.*\?>)/$1\n$xsl/; print header(-type=>'text/xml'); print $out; ########################################################### # songs.xsl
Artist Title Album Year