#!C:/Perl/bin/perl.exe -w #use strict; use XML::XPath; use Data::Dumper; use XML::XPath::XMLParser; my $xp = XML::XPath->new(filename => "new.xml"); my $nodeset = $xp->findnodes('/catalog/book/titles/title'); my @n = ("value one", "value two"); print $nodeset->size; my $i = 0; foreach my $node ($nodeset->get_nodelist) { print "\nGET: " . $xp->getNodeText($node) . "\n"; print "\nSET: " . $xp->setNodeText('/catalog/book/titles/title['."$i+1".']', $n[$i]) . "\n"; $i++; } open('FILE', '>output.xml'); my $nodes = $xp->find('/'); foreach my $node ($nodes->get_nodelist) { print FILE XML::XPath::XMLParser::as_string($node); } close(FILE); #### Gambardella, Matthew Book 1 Book 2 Computer 44.95 2000-10-01 An in-depth look at creating applications with XML. Ralls, Kim Book 3 Book 4 Fantasy 5.95 2000-12-16 A former architect battles corporate zombies, an evil sorceress, and her own childhood to become queen of the world.