in reply to help with regular expression required
Works on your example XML (once the structure is corrected):
#!/usr/bin/env perl use warnings; use strict; use XML::Twig; XML::Twig->new( keep_spaces => 1, twig_print_outside_roots => 1, twig_roots => { tu => sub { my ($twig, $elt) = @_; $elt->set_att('creationid','Simon Simonsen'); $elt->print; } }, )->parsefile('1097276.xml');
Prints to STDOUT, so redirect the output wherever you like (perl 1097276.pl >output.xml)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: help with regular expression required
by PitifulProgrammer (Acolyte) on Aug 14, 2014 at 13:15 UTC | |
by Anonymous Monk on Aug 14, 2014 at 21:22 UTC | |
by PitifulProgrammer (Acolyte) on Aug 18, 2014 at 15:25 UTC | |
by Anonymous Monk on Aug 18, 2014 at 15:53 UTC | |
by PitifulProgrammer (Acolyte) on Aug 19, 2014 at 09:52 UTC |