[LON-CAPA-cvs] cvs: loncom /xml lonxml.pm

albertel lon-capa-cvs@mail.lon-capa.org
Wed, 10 Apr 2002 15:19:59 -0000


albertel		Wed Apr 10 11:19:59 2002 EDT

  Modified files:              
    /loncom/xml	lonxml.pm 
  Log:
  - revert the addiont of <pre> to error messages
  - Start using LCParser, and attr_encoded
  - Rencode any high characters found before shipping things out
  - Addresses parts of BUG#68 and BUG#153 
  
  
Index: loncom/xml/lonxml.pm
diff -u loncom/xml/lonxml.pm:1.166 loncom/xml/lonxml.pm:1.167
--- loncom/xml/lonxml.pm:1.166	Wed Apr 10 10:46:30 2002
+++ loncom/xml/lonxml.pm	Wed Apr 10 11:19:59 2002
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # XML Parser Module 
 #
-# $Id: lonxml.pm,v 1.166 2002/04/10 14:46:30 matthew Exp $
+# $Id: lonxml.pm,v 1.167 2002/04/10 15:19:59 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -62,7 +62,7 @@
 use vars 
 qw(@pwd @outputstack $redirection $import @extlinks $metamode $evaluate %insertlist @namespace);
 use strict;
-use HTML::TokeParser();
+use HTML::LCParser();
 use HTML::TreeBuilder();
 use HTML::Entities();
 use Safe();
@@ -654,6 +654,8 @@
   #   $finaloutput.=&endredirection;
   # }
 
+  # Encode any high ASCII characters
+  $finaloutput=&HTML::Entities::encode($finaloutput,"\200-\377");
   if (($ENV{'QUERY_STRING'}) && ($target eq 'web')) {
     $finaloutput=&afterburn($finaloutput);
   }
@@ -1003,9 +1005,8 @@
 
 sub newparser {
   my ($parser,$contentref,$dir) = @_;
-  push (@$parser,HTML::TokeParser->new($contentref));
+  push (@$parser,HTML::LCParser->new($contentref));
   $$parser['-1']->xml_mode('1');
-#  $$parser['-1']->attr_encoded('1');
   if ( $dir eq '' ) {
     push (@Apache::lonxml::pwd, $Apache::lonxml::pwd[$#Apache::lonxml::pwd]);
   } else {
@@ -1249,7 +1250,7 @@
 sub error {
   if (($Apache::lonxml::debug eq 1) || ($ENV{'request.state'} eq 'construct') ) {
     # If printing in construction space, put the error inside <pre></pre>
-    print "<b>ERROR:</b><pre>".join("\n",@_)."</pre>\n";
+    print "<b>ERROR:</b>".join("\n",@_)."\n";
   } else {
     print "<b>An Error occured while processing this resource. The instructor has been notified.</b> <br />";
     #notify author