nick has asked for the wisdom of the Perl Monks concerning the following question:
<html> <head> <title>example</title> </head> <body> <text>Foo Bar</text> </body> </html>
#!/usr/bin/perl -w use strict; use XML::Twig; sub main() { my $filename = $ARGV[0] ? $ARGV[0] : die "specify input filena +me.\n"; my @tags = ('input', 'textarea', 'checkbox'); my $xml = XML::Twig->new( keep_spaces_in => [ 'pre' ], pretty_print => 'indented', twig_roots => { 'body' => \&insert_form_tags, }, twig_print_outside_roots => 1, ); $xml->parsefile("$filename"); $xml->print; } sub insert_form_tags() { my ($xml, $body) = @_; my $form_group = 'process_group'; my $form_name = 'process_requirements'; my $form = $body->insert( form => { method => "Post", action => "submit.cgi", }, ); } &main();
<html> <head> <title>example</title> </head> </html> <html> <body> <form action="submit.cgi" method="Post"> <text>Foo Bar</text> </form> </body> </html>
- Nick
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: XML::Twig generating invalid XHTML output??
by Tanktalus (Canon) on Feb 14, 2005 at 17:26 UTC | |
by nick (Sexton) on Feb 14, 2005 at 17:31 UTC | |
by ikegami (Patriarch) on Feb 14, 2005 at 17:55 UTC | |
by nick (Sexton) on Feb 14, 2005 at 17:59 UTC | |
by ikegami (Patriarch) on Feb 14, 2005 at 18:05 UTC | |
by Tanktalus (Canon) on Feb 14, 2005 at 17:38 UTC | |
by nick (Sexton) on Feb 14, 2005 at 17:56 UTC | |
|
Re: XML::Twig generating invalid XHTML output??
by mirod (Canon) on Feb 14, 2005 at 18:52 UTC |