#!/usr/bin/perl
# use module
use XML::Simple;
use Data::Dumper;
# create object
$xml = new XML::Simple;
# read XML file
$data = $xml->XMLin("DB.XML");
# access XML data
print "Server : $data->{SERVER}\n";
print "User : $data->{USER}\n";
print "Password : $data->{PASSWORD}\n";
print "Database : $data->{DBNAME}\n";
print "Table : $data->{TABLENAME}\n";
----------------------------------------------------------------------
XML file:
<?xml version ="1.0"?>
<DBCONNECTION>
<SERVER>ABC</SERVER>
<DBNAME>DEF</DBNAME>
<USER>GHI</USER>
<PASSWORD>JKL</PASSWORD>
<TABLENAME>MNO</TABLENAME>
</DBCONNECTION>
# use module
use XML::Simple;
use Data::Dumper;
# create object
$xml = new XML::Simple;
# read XML file
$data = $xml->XMLin("DB.XML");
# access XML data
print "Server : $data->{SERVER}\n";
print "User : $data->{USER}\n";
print "Password : $data->{PASSWORD}\n";
print "Database : $data->{DBNAME}\n";
print "Table : $data->{TABLENAME}\n";
----------------------------------------------------------------------
XML file:
<?xml version ="1.0"?>
<DBCONNECTION>
<SERVER>ABC</SERVER>
<DBNAME>DEF</DBNAME>
<USER>GHI</USER>
<PASSWORD>JKL</PASSWORD>
<TABLENAME>MNO</TABLENAME>
</DBCONNECTION>
No comments :
Post a Comment