|Don't ask to ask, just ask|
Replace XML tag names.by kyle (Abbot)
|on May 03, 2010 at 14:29 UTC||Need Help??|
kyle has asked for the
wisdom of the Perl Monks concerning the following question:
The question came to me one afternoon, "how long would it take you to write a Perl script that would remove a specific character from within XML tags?"
This was a need-it-now situation, so we went with the quick and dirty:
The input to deal with looks like this:
The problem is the dots in the tag names. They need to be stripped out. The output should look like this:
Note that my first implementation actually took the dot out of "<?xml version="1.0"?>". Luckily I had the good sense to look at a 'diff' before I stopped debugging.
So, monks, I seek your wisdom. What is the right way to do this so that I don't someday accidentally annihilate some important input? Any guidance you can offer would be appreciated.