Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

Re: Replace XML tag names.

by Anonymous Monk
on May 03, 2010 at 15:11 UTC ( #838127=note: print w/replies, xml ) Need Help??

in reply to Replace XML tag names.

#!/usr/bin/perl -- use strict; use warnings; use XML::Twig; { my $xml = <<'__XML__'; <?xml version="1.0"?> <TOP> <SUB> <THIS>STUFF</THIS> <SOME.TYPE>T</SOME.TYPE> <SOME.OTHER.TYPE>BLAH</SOME.OTHER.TYPE> </SUB> </TOP> __XML__ my $t = XML::Twig->new( pretty_print => 'indented', twig_handlers => { '_all_' => sub { my ( $t, $e ) = @_; my $tag = $e->tag; if ( $tag =~ s/\.//g ) { $e->set_tag($tag); } $t->flush; ## does the printing return; }, }, ); $t->xparse($xml); $t->purge; undef $t; } __END__ <?xml version="1.0"?> <TOP> <SUB> <THIS>STUFF</THIS> <SOMETYPE>T</SOMETYPE> <SOMEOTHERTYPE>BLAH</SOMEOTHERTYPE> </SUB> </TOP>

Replies are listed 'Best First'.
Re^2: Replace XML tag names.
by Anonymous Monk on Aug 03, 2012 at 09:23 UTC

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://838127]
[marto]: I saw this robot the other day, pretty fancy stuff. Things are pretty good jedikaiti, improving :) How are things with you?
[jedikaiti]: Doing OK, but a little achy this AM - I think the cats were using me as a wrestling mat and mattress while I was asleep last night.
[marto]: I can relate to that somewhat, I'm a light sleeper and frequently get woken up by kids doing much the same as your cats

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (13)
As of 2017-07-25 15:07 GMT
Find Nodes?
    Voting Booth?
    I came, I saw, I ...

    Results (374 votes). Check out past polls.