XML reads an entire file as one record, no line breaks / carriage return

Hi everyone
My customer has given me a file downloaded from their banking Site which, on import, is read as one single row / line even though the file has 85 rows of data. I opened the file in different text file readers, textpad and notepad++ and notepad and it clearly has rows of data...

How can I split the line at every 40th character while reading it in?

Hope someone can help.

Best Answer

  • Village_IdiotVillage_Idiot Member Posts: 14
    Answer ✓
    I have resolved this issue by setting a char limit/ length on the Integer table width. This seems to make sure that each row is cut off at 40.

Answers

  • vaprogvaprog Member Posts: 1,144
    Hi,

    Don't process xml as a text file. Use an XMLPort or some Dotnet XML parser. XML does not need line breaks in order to mark-up records of a table.

    Your XML-file, if it has line breaks indeed, probably uses Unix style line breaks (<LF> only, rather than windows standard <CR><LF>). An XML parser is required to convert line breaks to this format anyway, so, why not store it this way in the file in the first place.
  • Village_IdiotVillage_Idiot Member Posts: 14
    Answer ✓
    I have resolved this issue by setting a char limit/ length on the Integer table width. This seems to make sure that each row is cut off at 40.
  • JuhlJuhl Member Posts: 724
    Sounds like a bad idea.
    Use a parser...
    Follow me on my blog juhl.blog
  • EvREvR Member Posts: 178
    True, that's absolutely the worst idea. Don't treat XML like a glorified text file... Like so many have done in the past. Properly parse it as XML.
  • Village_IdiotVillage_Idiot Member Posts: 14
    The file is text, not XML.
  • JuhlJuhl Member Posts: 724
    Use xmlport
    Follow me on my blog juhl.blog
  • Village_IdiotVillage_Idiot Member Posts: 14
    i am doing that. the problem is solved
  • NavNabNavNab Member Posts: 181
    i am doing that. the problem is solved

    Hi Village_Idiot,

    I see that you already resolved your problem. But If you want to resolve it properly, then:

    1- Check your file with notepad++ (or equivalent). Show the special characters and see what is the return carriage on your file (CR, LF, CRLF ... or other)
    3- Check "RecordSeparator" property on your XMLport and set it to the adequate value from your file (By default it equals <<NewLine>>).

    The help says:
    facgcipl7lr4.jpg

  • Village_IdiotVillage_Idiot Member Posts: 14
    i am doing that. the problem is solved

    Hi Village_Idiot,

    I see that you already resolved your problem. But If you want to resolve it properly, then:

    1- Check your file with notepad++ (or equivalent). Show the special characters and see what is the return carriage on your file (CR, LF, CRLF ... or other)
    3- Check "RecordSeparator" property on your XMLport and set it to the adequate value from your file (By default it equals <<NewLine>>).

    The help says:
    facgcipl7lr4.jpg

    Thank you. You will notice in my very first post, I have written that I used notepad++ to check the file. and i did set record separators. Nothing worked until I set a limit on the record. It seems to work.
Sign In or Register to comment.