Paul
Paul

Reputation: 93

How to read this kind of txt dat file?

I received a txt file from the client and would like to import it to any kind of db.

I have google about the type of txt dat file but haven't found anything related

Here's part of the file I have and the file name is like name_TxtDat.txt

<JUDGES>
01 Paul Bask
02 Lisa Belin
03 Janet Bally
04 Rand Johnsons
05 Maze Hazam
</JUDGES>
<PLACEMENTS>
<702|701
., Kaka with Hac, Sam
Place|Time|Number|Heat|Competition|CompetitionCode|ScoresheetCode
-|10:32PM Sunday;6@11:11PM Sunday|338|Heat 764|AC-A Open|600|NONE
>
<891|685
., Ksusha with Kudashev, Ivan
Place|Time|Number|Heat|Competition|CompetitionCode|ScoresheetCode
-|10:44PM Sunday;6@11:41PM Sunday|186|Pro heat 9|Pro Open|837|NONE
>
</PLACEMENTS>
<COMPETITION>
DANCERCODES:16777293,1215
SHEETCODE:33554438
COMPCODE:1377
ENTRANTTYPE:Couple
AGE:A2
ROUND:Final
<RESULTS>
Heat 3: Final
|No.|10|12|13|14|17||1|Result|
|177 Vorvis/Timar|1|1|1|1|1||5|1|
</RESULTS>
</COMPETITION>

I think those text inside the <> is the table name and it used '|' to differentiate the columns. But I can understand why there's column's name for some of the tables and some don't. Also, why are there nested table like the text I provided, the inside . Has anyone familiar with this kind of file? Any help will be appreciate.

Upvotes: 0

Views: 64

Answers (1)

camba1
camba1

Reputation: 1820

Looks like a poorly made xml file to me. I added a top level node and removed some superfluous tags in the placements section and was able to open it as an xml file.

<?xml version="1.0" encoding="UTF-8"?>
<test>
   <JUDGES>
        01 Paul Bask
        02 Lisa Belin
        03 Janet Bally
        04 Rand Johnsons
        05 Maze Hazam
    </JUDGES>
    <PLACEMENTS>
        702|701
        ., Kaka with Hac, Sam
        Place|Time|Number|Heat|Competition|CompetitionCode|ScoresheetCode
        -|10:32PM Sunday;6@11:11PM Sunday|338|Heat 764|AC-A Open|600|NONE

        891|685
        ., Ksusha with Kudashev, Ivan
        Place|Time|Number|Heat|Competition|CompetitionCode|ScoresheetCode
        -|10:44PM Sunday;6@11:41PM Sunday|186|Pro heat 9|Pro Open|837|NONE
    </PLACEMENTS>
    <COMPETITION>
        DANCERCODES:16777293,1215
        SHEETCODE:33554438
        COMPCODE:1377
        ENTRANTTYPE:Couple
        AGE:A2
        ROUND:Final
        <RESULTS>
            Heat 3: Final
            |No.|10|12|13|14|17||1|Result|
            |177 Vorvis/Timar|1|1|1|1|1||5|1|
        </RESULTS>
    </COMPETITION>
</test>

I would go back to the client and see if they can clean it up on their side, otherwise you may have to do some custom logic to process the contents properly.

Upvotes: 1

Related Questions