in reply to Re: XML file as database
in thread XML file as database

Yes it's the nesting that's the problem. There is one such xml file by record (If my understanding of what a record is is correct) I just wanted to point out that there is nesting involved. What about col_map ? Can I assign a unique tag to the nested elements in there? -Chuck

Replies are listed 'Best First'.
Re^3: XML file as database
by jZed (Prior) on Sep 07, 2006 at 19:18 UTC
    Again, before I can answer that, I need to know how you want to conceptually handle the nesting. The "correct" way to put nested elements into a relational database would be to fold out additional lookup tables but that would get to be pretty complicated. The simplest (and "incorrect" i.e. non-relational) way is to serialize the data e.g. to join all of the nested fields into a single field with e.g. a semicolon separator. My guess is that your best option will be instead to "promote" the nested fields i.e. to go from this
    <PotentialSpecificHeat> <Bias>-4.43921585E-05</Bias> <Error1>0.53285588E-02</Error1> <Error2>0.57902443E-02</Error2> <Tau1>5.00000000E-01</Tau1> <Tau2>5.69579788E-01</Tau2> <Value>0.32688055</Value> </PotentialSpecificHeat>
    to this (eliminate PotentialSpecificHeat as an enclosing tag and promote its nested elements to unested tags with a PSH prefix to show their origin)
    <PSH_Bias>-4.43921585E-05</Bias> <PSH_Error1>0.53285588E-02</Error1> <PSH_Error2>0.57902443E-02</Error2> <PSH_Tau1>5.00000000E-01</Tau1> <PSH_Tau2>5.69579788E-01</Tau2> <PSH_Value>0.32688055</Value>
    If that kind of thing would work for you then you can use Perl to combine your files into one file and pre-process the nested tags into tags. You could then use DBD::AnyData on the results.