in reply to XML file as database

If you want to access data as a relational database, then the data needs to be arranged into records which contain a set number of fields each of which contains a single value. That is the basis of the "rigidity" of DBD::AnyData's XML format. The sample that you show does not appear to be divided into records (unless you are omitting some enclosing tag or unless you have one record per file) and some of the fields you show (e.g. PotentialSpecificHeat) contain multiple values. You need to conceptually reduce your data to fields, records, and values before you can treat it like a database regardless of whether you use AnyData or something else. If you can tell us how you'd do that reduction perhaps we can make some suggestions.

Replies are listed 'Best First'.
Re^2: XML file as database
by Woodchuck (Initiate) on Sep 07, 2006 at 19:01 UTC
    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
      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.