Quantcast
Channel: Trying to parse a XML file in perl using XML::Simple. But i am not getting expected result - Stack Overflow
Viewing all articles
Browse latest Browse all 3

Trying to parse a XML file in perl using XML::Simple. But i am not getting expected result

$
0
0

XML File :

<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE companies><companies><company><ticker>IBN</ticker><title>ICICI Bank Ltd</title><address>ICICI Bank Ltd.ICICI Bank TowersBandra-kurla Complex,  Mumbai</address><phonenum> 91 22 2653 6157</phonenum><faxnum> 91 22 2653 1175</faxnum><full_time> </full_time><website>http://www.icicibank.com</website><sector>Financial</sector><industry>Foreign Regional Banks</industry><news>Headlines Financial Blogs Company Events Message Board</news><sno>0</sno><fin_ticker>IBN</fin_ticker><marketcap>24.52B</marketcap><e_value>24.52B</e_value><ret_on_assets>0.74%</ret_on_assets><gross_profit>8.94B</gross_profit><prof_margin>10.79%</prof_margin><last_trade>44.05</last_trade><trade_time>Apr 8</trade_time><prev_close>44.52</prev_close><serialno>0</serialno><mgt_ticker>IBN</mgt_ticker></company><company> ... </company><company> ... </company><company> ... </company><company> ... </company></companies>

Perl Code :

use strict;use warnings;use XML::Simple;use Data::Dumper;my $xmlfile = "sample1.xml";my $xml = new XML::Simple;my $data = $xml->XMLin($xmlfile);#print Dumper($data);print "$data->{company}{title}\n";

Expected Output : ICICI Bank Ltd


Viewing all articles
Browse latest Browse all 3

Latest Images

Trending Articles





Latest Images