nick has asked for the wisdom of the Perl Monks concerning the following question:
<html> <body> What is Foo? </body> </html>
my $xml = XML::Twig->new(
twig_roots => {
'body' => \&insert_form_tags,
},
);
$xml->parsefile('index.html');
$xml->print;
sub insert_form_tags() {
my ($t, $body) = @_;
$body->insert(
form => {
method => "Post",
action => "submit.cgi"
},
);
}
<html> <body> <form method="Post" action="submit.cgi"> What is Foo? </form> </body> </html>
<html> <body> <form method="Post" action="submit.cgi"> <input type="text" name="foo_is" /> What is Foo? </form> </body> </html>
- Nick
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: XHTML with XML::Twig - tree manipulation problem
by mirod (Canon) on Feb 12, 2005 at 19:53 UTC |