Solved

How can I parse an xml file in Perl in a smart way using Perl modules

Posted on 2011-03-01
1
516 Views
Last Modified: 2012-05-11
Hi,
I have a Perl code which uses some soap web services and it returns the following output:

$VAR1 = {
          'createdBy' => 'tolgar',
          'subComponent' => 'mycomp',
          'geckId' => '123456',
          'comments' => '',
          'solution' => 'SOME TEXT IN HERE',
          'keywords' => ''
        };

Open in new window



Now I want  to  parse this XML file in the solution field and return the 'SOME TEXT IN HERE'. How can I do it without using regular expressions? Instead are there any modules in Perl that does parsing on an XML file?

Can you give me a simple example?

Thanks,
0
Comment
Question by:Tolgar
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 25

Accepted Solution

by:
clockwatcher earned 500 total points
ID: 35012476
That's not an XML file.  That appears to be a Data::Dumper output of a hash reference.  What code is giving you that output?  Guessing it looks like:

   print Dumper($somevar);

If that's the case, then:

   print $somevar->{'solution'};

will give you the SOME TEXT IN HERE.
0

Featured Post

Forrester Webinar: xMatters Delivers 261% ROI

Guest speaker Dean Davison, Forrester Principal Consultant, explains how a Fortune 500 communication company using xMatters found these results: Achieved a 261% ROI, Experienced $753,280 in net present value benefits over 3 years and Reduced MTTR by 91% for tier 1 incidents.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction In my previous article (http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SSIS/A_9150-Loading-XML-Using-SSIS.html) I showed you how the XML Source component can be used to load XML files into a SQL Server database, us…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question