I have an xml file which is not formatted in a convenient way.
I need to change the various references:
<col name="price">93147</col> <col name="value">93147</col>
to
<price>93147</price> <value>93147</value>
in perl I would use something like:
if ( $var =~ m|<col name="(.*?)">(.*?)</col>|g ) {
$var =~ s|<col name=".*?">.*?</col>|<$1>$2</$1>|g;
}
(untested!)What is the best way of tackling this in php?


Sign In
Create Account

Back to top









