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

albertel lon-capa-cvs@mail.lon-capa.org
Thu, 17 Feb 2005 08:34:57 -0000


albertel		Thu Feb 17 03:34:57 2005 EDT

  Modified files:              
    /loncom/xml	lonxml.pm 
  Log:
  - changes to xmlbegin to allow use inside javascript 
  
  
Index: loncom/xml/lonxml.pm
diff -u loncom/xml/lonxml.pm:1.355 loncom/xml/lonxml.pm:1.356
--- loncom/xml/lonxml.pm:1.355	Sun Jan 30 18:31:12 2005
+++ loncom/xml/lonxml.pm	Thu Feb 17 03:34:56 2005
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # XML Parser Module 
 #
-# $Id: lonxml.pm,v 1.355 2005/01/30 23:31:12 www Exp $
+# $Id: lonxml.pm,v 1.356 2005/02/17 08:34:56 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -149,20 +149,23 @@
 $Apache::lonxml::warnings_error_header='';
 
 sub xmlbegin {
-  my $output='';
-  @htmlareafields=();
-  if ($ENV{'browser.mathml'}) {
-      $output='<?xml version="1.0"?>'
+    my ($style)=@_;
+    my $output='';
+    @htmlareafields=();
+    if ($ENV{'browser.mathml'}) {
+	$output='<?xml version="1.0"?>'
             .'<?xml-stylesheet type="text/css" href="/adm/MathML/mathml.css"?>'
             .'<!DOCTYPE html SYSTEM "/adm/MathML/mathml.dtd" '
             .'[<!ENTITY mathns "http://www.w3.org/1998/Math/MathML">]>'
             .'<html xmlns:math="http://www.w3.org/1998/Math/MathML" ' 
-		.'xmlns="http://www.w3.org/TR/REC-html40">';
-  } else {
-      $output='<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html>';
-  }
-  return $output;
+	    .'xmlns="http://www.w3.org/TR/REC-html40">';
+    } else {
+	$output='<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html>';
+    }
+    if ($style eq 'encode') {
+	$output=&HTML::Entities::encode($output,'<>&"');
+    }
+    return $output;
 }
 
 sub xmlend {
@@ -284,7 +287,7 @@
     }
 }
 
-sub fontsettings() {
+sub fontsettings {
     my $headerstring='';
     if (($ENV{'browser.os'} eq 'mac') && (!$ENV{'browser.mathml'})) { 
 	$headerstring.=