Diff for /loncom/homework/cleanxml/xml_to_loncapa.pm between versions 1.1 and 1.2

version 1.1, 2015/12/03 20:40:31 version 1.2, 2015/12/18 22:08:51
Line 92  sub node_to_string { Line 92  sub node_to_string {
       $s .= ' ';        $s .= ' ';
       $s .= $attribute->nodeName;        $s .= $attribute->nodeName;
       $s .= '="';        $s .= '="';
       $s .= escape($attribute->nodeValue);        $s .= escape_attribute($attribute->nodeValue);
       $s .= '"';        $s .= '"';
     }      }
     if ($node->hasChildNodes()) {      if ($node->hasChildNodes()) {
Line 110  sub node_to_string { Line 110  sub node_to_string {
   }    }
 }  }
   
 # Escapes a string for LON-CAPA output (used for text nodes, not attribute values)  # Escapes an attribute value
 sub escape {  sub escape_attribute {
   my ($s) = @_;    my ($s) = @_;
   $s =~ s/&/&/sg;    # normal XML escapes do not work with LON-CAPA, for instance with reactionresponse
   $s =~ s/</&lt;/sg;    #$s =~ s/&/&amp;/sg;
   $s =~ s/>/&gt;/sg;    #$s =~ s/</&lt;/sg;
   # quot and apos do not need to be escaped outside attribute values    #$s =~ s/>/&gt;/sg;
     $s =~ s/"/&quot;/sg;
   return $s;    return $s;
 }  }
   

Removed from v.1.1  
changed lines
  Added in v.1.2


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>