Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: Replace XML tag names.

by ikegami (Pope)
on May 03, 2010 at 15:24 UTC ( #838132=note: print w/ replies, xml ) Need Help??


in reply to Replace XML tag names.

Using an different parser:

#!/usr/bin/perl use strict; use warnings; use XML::LibXML; { 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 $doc = XML::LibXML->new->parse_string($xml); for ($doc->findnodes('//*')) { my $name = $_->nodeName(); $name =~ tr/.//d; $_->setNodeName($name); } print($doc->toString()); }


Comment on Re: Replace XML tag names.
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://838132]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (8)
As of 2014-09-18 09:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (109 votes), past polls