perl, how to print xml element

Posted on 2011-05-12
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

    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:

    Author Closing Comment

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

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Threat Intelligence Starter Resources

    Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

    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…
    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…
    This video is in connection to the article "The case of a missing mobile phone (". It will help one to understand clearly the steps to track a lost android phone.

    760 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

    12 Experts available now in Live!

    Get 1:1 Help Now