set_uk has asked for the wisdom of the Perl Monks concerning the following question:
I am trying to convert Oracle SQL query output to XML.
I'm sure someone has tackled this issue previous to me.
I am using the following code to write an XML file:-
$SelectStatement=$SQL->get($StmntTsk{Def},$StmntTsk{Args}) or throw TNBCriticalException("Cannot get SELECT SQL from Phrasebook"); my $XmlOutFile = $fqd_runlogdir.$MSTR::DLM.$StmntTsk{XMLOutput}; my $ya = XML::Handler::YAWriter->new(AsFile => $XmlOutFile); my $generator = XML::Generator::DBI->new( Handler => $ya, dbh => $dbh, ShowColumns => True ); $generator->execute($SelectStatement);
Problem is when I have NULL entries in a database column I get no XML element - when what I want is an empty element. This is because I sometimes want to manipulate the XML into CSV and to have it formatted correctly it needs a comma for each NULL - which I cant do unless I can process a Node in the nodeset via XSL.
Now I know I could change my SQL to wrap these columns with NVL but I thought there might be a way with DBD/Perl to process the NULL's and maintain the elements
Back to
Seekers of Perl Wisdom