By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,848 Members | 1,363 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,848 IT Pros & Developers. It's quick & easy.

getting a part of a message in a excel folder

P: 2

I am new to perl .My requirement is that I am querying database and fetching 2 data one is msg_nbr and other is tehre corresponding xml message.

I am getting all the xml message in a variable .Now what is need is to fetch only the part of the xml data whixch is enclosed within the tags <notag>anything..,..</noTag>. and export it to a excel sheet along withthe corresponding msg nbrs.

I am trying the follwing code

Expand|Select|Wrap|Line Numbers
  1. while (my @row_ary  = $sth->fetchrow_array)
  2. {
  3.         my @row = ($row_ary[0],
  4.                 $row_ary[1],
  5.                  );
  6.         $count++;
  7.         my $locMsgnbr = $row_ary[0];
  8.         my $locxmldata =  $row_ary[1];
  9. #       print("$locxmldata \n");
  10.     #            $row_ary[1] =~ /<noTag>(.*?)<\/noTag>/;
  11.         $locxmldata =~ m/<noTag>(.*?)<\/noTag>/;
  12.         #$row_ary[1] = ~ /<noTag>(.*?)<\/noTag>/;
  13.            $notagdata = $1;
  14.         print ("$notagdata \n");
  15.         my $rowName = 'A'.$count;
  16.         worksheet1->write($rowName,$row_ary[0],$notagdata);
  18. }
Please help.
Jan 3 '08 #1
Share this Question
Share on Google+
1 Reply

Expert 100+
P: 971
Are you having problems getting the regex to work or are you having other problems? When it comes to extracting data from attribute tags it is best to use a parser designed to do so.

Jan 7 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.