[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now


perl, how to print xml element

Posted on 2011-05-12
Medium Priority
Last Modified: 2012-05-11
How to print $response?
perl code:
    my $response = XML::LibXML::Element->new("response");

    my $message_response = XML::LibXML::Element->new("element1");

Question by:rgbcof
LVL 10

Accepted Solution

SANTABABY earned 2000 total points
ID: 35750329
Please try the following:
my $xmlstr
$xmlstr = $response->toString($format,$docencoding);

(See below for daetisl on the arguments to the function).

This function is defined in XML::LibXML::Node .

Useful Ref: http://perl.enstimac.fr/perl5.6.1/site_perl/5.6.1/sun4-solaris/XML/LibXML/Node.html

Author Closing Comment

ID: 35750934
It was an element, so I had to use ->textContent()

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

Many time we need to work with multiple files all together. If its windows system then we can use some GUI based editor to accomplish our task. But what if you are on putty or have only CLI(Command Line Interface) as an option to  edit your files. I…
I have been pestered over the years to produce and distribute regular data extracts, and often the request have explicitly requested the data be emailed as an Excel attachement; specifically Excel, as it appears: CSV files confuse (no Red or Green h…
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…
Six Sigma Control Plans
Suggested Courses

834 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