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

How can I get a string representation of an XML::XPath object?

I have a script that is using the XML::XPath module from CPAN to manipulate an XML document by pulling in a template and setting some node text values.  The code is similar to the following:

my $notificationXML = XML::XPath->new(xml => $notificationRqst );   #where $notificationRqst is a string of XML


So, at this point, I have (I think) my original XML with one node value changed.  Now I want to pass the $notificationXML object to another command, which accepts a variable containing a string of XML (same as the $notificationRqst variable $notificationXML was created from.

Not sure if my question is making sense, since I'm not sure how to ask it. If you need clarification please ask.
1 Solution
I haven't used XML::XPath much but it looks like the below will work:
print $notificationXML->findnodes_as_string('/');
# at least I think / will find all nodes

Open in new window

BbouchAuthor Commented:
Wow.  That was too easy. Thanks for the extra set of eyes :)

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

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