basicdez has asked for the wisdom of the Perl Monks concerning the following question:
This is only a small piece of the file, but if you can help me to know how to read this in through a port and then store it somehow (my guess is hash references), then take each field and create an XML tree, that would be awesome. Again, I ask of you not to be overly critical of me as I am only an egg and and am humbly asking for your help with this one. Another side note, notice under the PER packet that there is a comma delimitted field being passed in that would need to be read into one area and then split out for the creation of this tree... Here is how the tree would look..."DESTINATION" "localhost" "x2pd" "HDR" "HDR-1" "" "HDR-3" "" "" "" "HDR-7" "09/06/2001" 99999 "" "hdr-11" "hd +r-12" "" "" "B" "INI" "INI-1" "" "INI-3" "INI-4" "INI-5" 0 0 "88888888" 9999.99 "PER" "A1" yes "per-3" "" "per-5,per-5,per-5,per-5,per-7,per-5,per-5" "" "77 +7777777" 01/01/71 99 "10101010" 0 0 "13" ""
Sincerely and humbly, dez L Please notice that the incoming data stream is seperated by "s in some spots and spaces in others, this is leaving me with great frustration, as you can only imagine.<?xml version="1.0"?> <application id =”_10”> <account_application> <destination>localhost</destination> <application_type>x2pd</application_type> </account_application> <header> <header-1>HDR-1</header-1> <header-2></header-2> <header-3>HDR-3</header-3> <header-4></header-4> <header-5></header-5> <header-6></header-6> <header-7>HDR-7</header-7> <header-8>09/06/2001</header-8> <header-9>99999</header-9> <header-10></header-10> <header-11>hdr-11</header-11> <header-12>hdr-12</header-12> <header-13>B</header-13> </header> <ini> <ini-1>INI-1</ini-1> <ini-2></ini-2> <ini-3>INI-3</ini-3> <ini-4>INI-4<ini-4> <ini-5>INI-5</ini-5> <ini-6>0</ini-6> <ini-7>0</ini-7> <ini-8>88888888</ini-8> <ini-9>9999.99</ini-9> </ini> <personal> <personal-1>A1</personal-1> <personal-2>yes</personal-2> <personal-3>per-3</personal-3> <personal-4></personal-4> <personal-6></personal-6> <personal-7>777777777</personal-7> <personal-8>01/01/1971</personal-8> <personal-9>99</personal-9> <personal-10>10101010</personal-10> <personal-11>0</personal-11> <personal-12>0</personal-12> <personal-13>13</personal-13> <personal-14></personal-14> </personal> <comment> <personal-5>per-5</personal-5> </comment> <comment> <personal-5>per-5</personal-5> </comment> <comment> <personal-5>per-5</personal-5> </comment> <comment> <personal-5>per-5</personal-5> </comment> <comment> <personal-5>per-7</personal-5> </comment> <comment> <personal-5>per-5</personal-5> </comment> <comment> <personal-5>per-5</personal-5> </comment>
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Reading in through a port and into a hash?
by IraTarball (Monk) on Oct 16, 2001 at 22:04 UTC |