• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 571
  • Last Modified:

perl, how to print xml element

How to print $response?
perl code:
    my $response = XML::LibXML::Element->new("response");

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


0
rgbcof
Asked:
rgbcof
1 Solution
 
SANTABABYCommented:
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
0
 
rgbcofAuthor Commented:
It was an element, so I had to use ->textContent()
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Exchange Server

The MCTS: Microsoft Exchange Server 2010 certification validates your skills in supporting the maintenance and administration of the Exchange servers in an enterprise environment. Learn everything you need to know with this course.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now