in reply to Using the XML::Parser Module
#!/usr/bin/perl -w use strict; use XML::GDOME; my $fname = '/path/to/your.xml'; my $doc = XML::GDOME->createDocFromURI($fname,GDOME_LOAD_SUBSTITUTE_EN +TITIES); # or whatever gdome options float your boat my @nodes = $doc->findnodes('/xpath/to/required/element'); foreach my $node (@nodes) { if (needToUpdateAttribute($node)) { my $attributeName = getRequiredAttrName(...); my $newValue = getNewAttrValue(...); $node->setAttribute($attributeName, $newValue); } }
...reality must take precedence over public relations, for nature cannot be fooled. - R P Feynmann
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Using the XML::Parser Module
by Aristotle (Chancellor) on Nov 02, 2005 at 22:58 UTC | |
by raina (Initiate) on Nov 03, 2005 at 06:06 UTC |