my $f = $ARGV[0];
die("Bad extension of $f") if ($f !~ /\.xml$/);
die("Could not read $f") if (!open(FI, $f));
-my ($fh, $filename) = tempfile("tempXXXX", SUFFIX => '.xml', DIR => '/tmp', UNLINK => 0);
+my ($fh, $filename) = tempfile("tempXXXX", SUFFIX => '.xml', UNLINK => 0);
while (my $l = <FI>) {
chomp($l);
$l = convert($l);
$err = 1;
@errors = ("Could not run xmllint\n");
}
-#unlink($filename);
-print "Not unlinking $filename\n";
+unlink($filename);
if ($err > 0) {
die(join('', @errors));
}
if ($para =~ /^\s*([a-z]+(:[a-z]+)?)\s*=\s*(.*)$/) {
my $val;
my ($p, $rest) = ($1, $3);
- if ($rest =~ /^(\'[^\']*\')(.*)$/) {
+ if ($rest =~ /^(\'([^\']|\\\')*\')(.*)$/) {
$val = $1;
- $rest = $2;
+ $rest = $3;
}
- elsif ($rest =~ /^(\"[^\"]*\")(.*)$/) {
+ elsif ($rest =~ /^(\"([^\"]|\\\")*\")(.*)$/) {
$val = $1;
- $rest = $2;
+ $rest = $3;
}
elsif ($rest =~ /^([^\s]+)(.*)$/) {
- $val = '"' . $1 . '"';
+ my $val1 = $1;
$rest = $2;
+ $val1 =~ s/([\"\'\\])/\\$1/g;
+ $val = '"' . $val1 . '"';
}
else {
die("param error for rest = $rest");