how to put those in Dbase

Hi Experts,

I have a file which contains-
..
..
<?xml version='1.0' encoding='ISO-8859-1' standalone='no'?>
<LogItems>
<log logid="83efeae5190809080000080410">
<category>Upstream.TEL</category>
<operation>MAKE</operation>
<target>mms</target>
<user>purple</user>
<starttime>20080908000008.985701</starttime>
<stoptime>20080908000009.293774</stoptime>
<status>OKAY</status>
</log>
</LogItems>

<?xml version='1.0' encoding='ISO-8859-1' standalone='no'?>
<LogItems>
<log logid="83efeae5190809080001290411">
<category>Upstream.TEL</category>
<operation>DEL</operation>
<target>MMS</target>
<starttime>20080908000129.697712</starttime>
<stoptime>20080908000130.135911</stoptime>
<status>NOK</status>
</log>
</LogItems>
...
...

I want to put them in the database field by field like catagory, operation target....status; in this way. AND will make a sql query from it. COULD YOU PLEASE HELP ME ON THIS?

KR//Purple

you can use perl :xml parser to parse this file
Sample perl code.
#!/usr/bin/perl
use XML::Simple;
use Data::Dumper;
my $config = XMLin('new.xml');
print Dumper($config);
i/p:
<?xml version='1.0' encoding='ISO-8859-1' standalone='no'?>
<LogItems>
<log logid="83efeae5190809080000080410">
<category>Upstream.TEL</category>
<operation>MAKE</operation>
<target>mms</target>
<user>purple</user>
<starttime>20080908000008.985701</starttime>
<stoptime>20080908000009.293774</stoptime>
<status>OKAY</status>
</log>
</LogItems>
Output:
$VAR1 = {
'log' => {
'status' => 'OKAY',
'stoptime' => '20080908000009.293774',
'target' => 'mms',
'starttime' => '20080908000008.985701',
'user' => 'purple',
'category' => 'Upstream.TEL',
'operation' => 'MAKE',
'logid' => '83efeae5190809080000080410'
}
};

your perl script will return hashmap some thing like above.You just need to make key as column name and value value for the coulum and insert using perl DBI module

Not a fair idea...the best one is to use the XML Parser module in perl....I have givena try like this :

Output:


  1. \?/ ↩︎

great work!!!!!:b: