Here's how I understand your problem. The XML you are interested in seems to have the following structure:

You want to store this data into a database by 'flattening' it. The pseudo-code would then go something like this:

for each CITY/replication node: my %v = (); $v{replication} = parsed replication value; $v{partno} = parsed Part_No value; for each AbCar node: my %v1 = %v; $v1{Ref} = parsed ref value; $v1{Fname} = parsed Fname value; # save %v1 here (to a db table or to a list) end for for each AbCarr node: my %v1 = %v; $v1{RefD} = parsed RefD value; $v1{Lic} = parsed Lic value; for each AbCarr/Warr node: my %v2 = %v1; $v2{VD} = parsed VD value; $v2{Billa1} = parsed Billa1 value; $v2{Billa2} = parsed Billa2 value; # save %v2 here end for for each AbCarr/ADCar node: my %v2 = %v1; $v2{REFI} = parsed REFI value; $v2{Carr} = parsed Carr value; # save %v2 here end for end for end for

You have three kinds of records. so I would expect there to be three different database tables.


In reply to Re: Inserting Multiple Records in DB. by pc88mxer
in thread Inserting Multiple Records in DB. 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.