Solved

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

Posted on 2011-03-01
1
481 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
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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

The Problem How to write an Xquery that works like a SQL outer join, providing placeholders for absent data on the outer side?  I give a bit more background at the end. The situation expressed as relational data Let’s work through this.  I’ve …
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
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…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

757 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now