• 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

$notificationXML->setNodeText('/notificationRequestDtl/notificationRequestDtlHdr/priority','HIGH');


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.
0
Bbouch
Asked:
Bbouch
1 Solution
 
wilcoxonCommented:
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

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

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