Changeset 0e5f64d7572f24c142e6ef6357ee94733dad2b54

Show
Ignore:
Timestamp:
01/06/10 18:36:54 (9 years ago)
Author:
Mark Harrison <mark@omniti.com>
git-committer:
Mark Harrison <mark@omniti.com> 1262803014 +0000
git-parent:

[a1ad6400841329d537a446b6feefa6d029f5ca3b]

git-author:
Mark Harrison <mark@omniti.com> 1262803014 +0000
Message:

Fix malformed XML when using hashes as results

git-svn-id: https://labs.omniti.com/resmon/trunk@235 8c0face9-b7db-6ec6-c4b3-d5f7145c7d55

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • lib/Resmon/Status.pm

    r95026f2 r0e5f64d  
    6969          $v = $v->[0]; 
    7070        } 
     71        $v = xml_escape($v); 
    7172        $rv .= ">$v</$key>\n"; 
    7273      } 
    7374    } else { 
    7475      $rv .= " " x $indent; 
    75       $value =~ s/&/&amp;/g; 
    76       $value =~ s/</&lt;/g; 
    77       $value =~ s/>/&gt;/g; 
    78       $value =~ s/'/&apos;/g; 
     76      $value = xml_escape($value); 
    7977      $rv .= "<$key>$value</$key>\n"; 
    8078    } 
     
    8987  $rv .= "  </ResmonResult>\n"; 
    9088  return $rv; 
     89} 
     90sub xml_escape { 
     91  my $v = shift; 
     92  $v =~ s/&/&amp;/g; 
     93  $v =~ s/</&lt;/g; 
     94  $v =~ s/>/&gt;/g; 
     95  $v =~ s/'/&apos;/g; 
     96  return $v; 
    9197} 
    9298sub dump_generic {