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
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|