in reply to Search and Replace in XML

Looks like a perfect task for XML::Rules in the filter mode. Create a new XML::Rules object with style => 'filter' and a custom rule for <REF> tags replacing the _content by the value of the EXT attribute and use the filter() or filterfile() method.

Jenda
Enoch was right!
Enjoy the last years of Rome.

Replies are listed 'Best First'.
Re^2: Search and Replace in XML
by Anonymous Monk on Sep 14, 2009 at 17:39 UTC
    seems easy using the rules. but never worked with XML::RULES, would it be simple to learn fast?

      Depends. If you are used to passing subroutine references around or to a declarative style of programming it should be a no-brainer. If you are set on the procedural thinking, it takes some brain rewiring. In this particular case the implementation really is simple. You load the module, you define the object with just a single custom rule that copies the $_[1]->{EXT} to $_[1]->{_content} and returns the $_[0] => $_[1] pair and then call the filter() or filterfile() method. It's all documented. Try and ask if you do not understand something or if something does something unexpected.

      Jenda
      Enoch was right!
      Enjoy the last years of Rome.