in reply to Modify XML tags
Hi. Is there a way to change all tags and attributes in XML to lower case?
Sure, here is a start
#!/usr/bin/perl -- use strict; use warnings; use XML::Twig; my $str = <<'EOF'; <NoTe> <To> <Person>Satan</Person> </To> <Beef><SaUsAGe>is Tasty</SaUsAGe></Beef> </NoTe> EOF { my $t = XML::Twig->new( pretty_print => 'indented', force_end_tag_handlers_usage => 1, start_tag_handlers => { _all_ => sub { $_->set_tag( lc $_->ta +g ); return }, }, end_tag_handlers => { _all_ => sub { $_->set_tag( lc $_->tag +); return }, }, ); $t->parse($str); $t->flush(); } __END__
(Faced XPath feature being case-insensitive)
Why is this a problem?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Modify XML tags
by mirod (Canon) on Nov 19, 2011 at 11:27 UTC | |
by Anonymous Monk on Nov 20, 2011 at 05:53 UTC | |
by Anonymous Monk on May 30, 2013 at 02:03 UTC | |
|
Re^2: Modify XML tags
by elgato (Novice) on Nov 21, 2011 at 06:31 UTC | |
by Anonymous Monk on Nov 21, 2011 at 11:04 UTC |