Hello wise Monks,

again I have a question:
I have to convert several CSV files to some kind of XML. The Perl script reads all CSV and builds several lists and hashes.

To sum it up:
There are 1500 messages overall, but the script only works for 1495! The remaining 5 messages aren't properly handled. Why?

In detail:
The CSV lines all look like this

Fehler_SWCA_UgaUgeMSG ,M_sw_canInter,506,KL_FAT,BHI, +AUS_DEFAULT,AKT_NOTAUS,"""MSG Ueberlauf""","""UGA UGE MSG Ueberlauf"" +",""" """
This is one of those that DON'T work, but I didn't recognize any difference to any other line so far.

The text between the groups of '"""' should show up in the result file as XML element. The structure should look like this:

<MSG id="E_Fehler_SWCA_UgaUgeMSG"> <TXT_S> <TXT lang="de">"MSG Ueberlauf"</TXT> </TXT_S> <TXT_L> <TXT lang="de">"UGA UGE MSG Ueberlauf"</TXT> </TXT_L>
But it actually does look like that:
<MSG id="E_Fehler_SWCA_UgaUgeMSG"> <TXT_S> </TXT_S> <TXT_L> </TXT_L>
We see that not only the content of the <TXT> elements is missing, but the WHOLE LINE! What's going on there??

I set some kind of debug output in my perl script, which looks like this:

foreach $txt (@{$txtById{$id}}) { print OUTFILE "\t\t<TXT_S>\n"; if ($msg->{id} eq "E_Fehler_SWCA_UgaUgeMSG") #DEBUG OUTPUT { print "$msg->{id}\nTXT =\n$txt->{id}\n$txt->{lang}\n$txt->{txt +S}\n$txt->{txtL}\n"; } print OUTFILE "\t\t\t<TXT lang=\"$txt->{lang}\">\"$txt->{txtS}\"</ +TXT>\n"; print OUTFILE "\t\t</TXT_S>\n"; print OUTFILE "\t\t<TXT_L>\n"; print OUTFILE "\t\t\t<TXT lang=\"$txt->{lang}\">\"$txt->{txtL}\"</ +TXT>\n"; print OUTFILE "\t\t</TXT_L>\n"; }
In my shell window I get that output:
E_Fehler_SWCA_UgaUgeMSG TXT = E_Fehler_SWCA_UgaUgeMSG de MSG Ueberlauf UGA UGE MSG Ueberlauf
which is what I expected.
Each field is filled with proper data. It does print on the screen but not in the file, and I don't have any clue. :-(

Thanks in advance for helping,
Faltblatt


In reply to print line not showing up by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.