Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

Situation: HUGE xml files with lots of informations that are not needed, we talk about millions of rows and lots of GB, and i don't understand , get confused with the dumper output
Example XML file (test.xml)

<BL_DPLI_ENTRY> <BL_USER> <USERID>22069332</USERID> <PHONENO> <ENTRY>877465535</ENTRY> </PHONENO> <PHONENO> <ENTRY>86719273704</ENTRY> </PHONENO> <PHONENO> <ENTRY>8671881760</ENTRY> </PHONENO> <PHONENO> <ENTRY>8671969876</ENTRY> </PHONENO> <ADDRESS> <LASTNAME>Müller</LASTNAME> <FIRSTNAME>heiner</FIRSTNAME> <MAIDENNAME/> <STREET>Entenhausenerweg</STREET> <STREET_NO>15</STREET_NO> <ZIP>660666</ZIP> <CITY>Entenhausen</CITY> <COUNTRY>D</COUNTRY> </ADDRESS> </BL_USER> <BL_DPLI_RECORD> <DATE_CREATED>2006-01-31</DATE_CREATED> <DATE_LAST_UPDATE>2006-01-30</DATE_LAST_UPDATE> <REASON> <ENTRY>highspender limit exceeded</ENTRY> <DATE_OCCURRED>2006-01-30</DATE_OCCURRED> </REASON> <BL_DP_TOTAL> <NUMBER_DENIED_PAYMENTS_TOTAL>0</NUMBER_DENIED_PAYMENTS_TOTAL> <DATE_OLDEST_INVOICE/> <MONETARYVALUE> <V>0.00</V> <C>EUR</C> </MONETARYVALUE> </BL_DP_TOTAL> <BL_LI_RECORD> <DATE_LAST_UPDATE>2006-01-30</DATE_LAST_UPDATE> <MONETARYVALUE> <V>215.84</V> <C>EUR</C> </MONETARYVALUE> </BL_LI_RECORD> </BL_DPLI_RECORD> </BL_DPLI_ENTRY>

Dumper output
$VAR1 = { 'BL_DPLI_RECORD' => { 'REASON' => { 'DATE_OCCURRED' => '2006 +-01-30', 'ENTRY' => 'highspender +limit exceeded' }, 'BL_LI_RECORD' => { 'MONETARYVALUE' => + { + 'C' => 'EUR', + 'V' => '215.84' + }, 'DATE_LAST_UPDATE' + => '2006-01-30' }, 'BL_DP_TOTAL' => { 'DATE_OLDEST_INVOIC +E' => {}, 'MONETARYVALUE' => +{ + 'C' => 'EUR', + 'V' => '0.00' +}, 'NUMBER_DENIED_PAYM +ENTS_TOTAL' => '0' }, 'DATE_LAST_UPDATE' => '2006-01-30', 'DATE_CREATED' => '2006-01-31' }, 'BL_USER' => { 'USERID' => '22069332', 'ADDRESS' => { 'COUNTRY' => 'D', 'MAIDENNAME' => {}, 'CITY' => 'Entenhausen', 'ZIP' => '660666', 'LASTNAME' => 'M&#65533;ller', 'FIRSTNAME' => 'heiner', 'STREET' => 'Entenhausenerweg' +, 'STREET_NO' => '15' }, 'PHONENO' => [ { 'ENTRY' => '877465535' }, { 'ENTRY' => '86719273704' }, { 'ENTRY' => '8671881760' }, { 'ENTRY' => '8671969876' } ] } };

I need all Phone numbers with the reason behind (entry)
Example

__OUT__ 877465535;highspender limit exceeded 86719273704;highspender limit exceeded 8671881760;highspender limit exceeded 8671969876;highspender limit exceeded

i attemped so far xml::simple with data::dumper, but i get confused howto access a record for each Customer because they always start with BL_DPLI_RECORD
tips hints are definatly needed

kd ultibuzz


#!"C:\perl\bin\perl.exe" use warnings; use strict; use XML::Simple; use Data::Dumper; my $config = XMLin('test.xml'); open(OUT,'>','out.txt') or die; print OUT Dumper($config);

Edited by planetscape - added readmore tags


In reply to Confusion ,XML::SIMPLE with DATA:DUMPER by ultibuzz

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



  • 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.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (4)
As of 2024-04-25 13:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found