in reply to Changing XML Data
You could use XSLT, although I suspect that few XSLT processors can do streaming transformation (ie they would probably need to load the entire document in memory before starting to work), but 1 - I might be wrong and 2 - it may not matter.
With XML::Twig you would write something like this (I am assuming here that content is an attribute of the meta element, as you did not show us the data you are working on):
#!/usr/bin/perl use strict; use warnings; use XML::Twig; my $t= XML::Twig->new( twig_roots => { 'package/metadata/x-metadata/me +ta[@name="dtb:totalTime"]' # $_ is the current element => sub { $_->set_att( content = +> $_->att( 'content') +1); $_->print; } }, twig_print_outside_roots => 1, ) ->parsefile( 'package.xml');
|
|---|