in reply to Update an XML node value based on one of the attribute values.
use strict; use XML::Rules; my $filter = XML::Rules->new( style => 'filter', rules => { ReferenceID => sub { my ($tag, $attr) = @_; if ($attr->{referenceIDType} eq 'FXDD') { $attr->{_content} = "the changed content"; } return $tag => $attr; } } ); $filter->filter(\*DATA); __DATA__ <root> <ReferenceID referenceIDType="FXDD">FXDDILN233</ReferenceID> <ReferenceID referenceIDType="RXDD">FXDDILN233</ReferenceID> </root>
Jenda
Enoch was right!
Enjoy the last years of Rome.
|
|---|