--- loncom/xml/lonxml.pm 2001/01/06 16:22:55 1.46
+++ loncom/xml/lonxml.pm 2008/03/07 21:17:04 1.473
@@ -1,242 +1,633 @@
# The LearningOnline Network with CAPA
# XML Parser Module
#
-# last modified 06/26/00 by Alexander Sakharuk
-# 11/6 Gerd Kortemeyer
-# 6/1/1 Gerd Kortemeyer
+# $Id: lonxml.pm,v 1.473 2008/03/07 21:17:04 www Exp $
+#
+# Copyright Michigan State University Board of Trustees
+#
+# This file is part of the LearningOnline Network with CAPA (LON-CAPA).
+#
+# LON-CAPA is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# LON-CAPA is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with LON-CAPA; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# /home/httpd/html/adm/gpl.txt
+#
+# http://www.lon-capa.org/
+#
+# Copyright for TtHfunc and TtMfunc by Ian Hutchinson.
+# TtHfunc and TtMfunc (the "Code") may be compiled and linked into
+# binary executable programs or libraries distributed by the
+# Michigan State University (the "Licensee"), but any binaries so
+# distributed are hereby licensed only for use in the context
+# of a program or computational system for which the Licensee is the
+# primary author or distributor, and which performs substantial
+# additional tasks beyond the translation of (La)TeX into HTML.
+# The C source of the Code may not be distributed by the Licensee
+# to any other parties under any circumstances.
+#
+
package Apache::lonxml;
use vars
-qw(@pwd $outputstack $redirection $textredirection $on_offimport @extlinks);
+qw(@pwd @outputstack $redirection $import @extlinks $metamode $evaluate %insertlist @namespace $errorcount $warningcount);
use strict;
-use HTML::TokeParser;
-use Safe;
-use Safe::Hole;
-use Opcode;
-use Apache::Constants qw(:common);
+use LONCAPA;
+use HTML::LCParser();
+use HTML::TreeBuilder();
+use HTML::Entities();
+use Safe();
+use Safe::Hole();
+use Math::Cephes();
+use Math::Random();
+use Opcode();
+use POSIX qw(strftime);
+use Time::HiRes qw( gettimeofday tv_interval );
+use Symbol();
sub register {
- my $space;
- my @taglist;
- my $temptag;
- ($space,@taglist) = @_;
- foreach $temptag (@taglist) {
- $Apache::lonxml::alltags{$temptag}=$space;
+ my ($space,@taglist) = @_;
+ foreach my $temptag (@taglist) {
+ push(@{ $Apache::lonxml::alltags{$temptag} },$space);
}
}
-
-use Apache::style;
-use Apache::lontexconvert;
-use Apache::run;
-use Apache::londefdef;
-use Apache::scripttag;
-#================================================== Main subroutine: xmlparse
+
+sub deregister {
+ my ($space,@taglist) = @_;
+ foreach my $temptag (@taglist) {
+ my $tempspace = $Apache::lonxml::alltags{$temptag}[-1];
+ if ($tempspace eq $space) {
+ pop(@{ $Apache::lonxml::alltags{$temptag} });
+ }
+ }
+ #&printalltags();
+}
+
+use Apache::Constants qw(:common);
+use Apache::lontexconvert();
+use Apache::style();
+use Apache::run();
+use Apache::londefdef();
+use Apache::scripttag();
+use Apache::languagetags();
+use Apache::edit();
+use Apache::inputtags();
+use Apache::outputtags();
+use Apache::lonnet;
+use Apache::File();
+use Apache::loncommon();
+use Apache::lonfeedback();
+use Apache::lonmsg();
+use Apache::loncacc();
+use Apache::lonmaxima();
+use Apache::lonlocal;
+
+#==================================== Main subroutine: xmlparse
+
+#debugging control, to turn on debugging modify the correct handler
+
+$Apache::lonxml::debug=0;
+
+# keeps count of the number of warnings and errors generated in a parse
+$warningcount=0;
+$errorcount=0;
+
+#path to the directory containing the file currently being processed
@pwd=();
-$outputstack = '';
-$redirection = 1;
-$textredirection = 1;
-$on_offimport = 0;
+
+#these two are used for capturing a subset of the output for later processing,
+#don't touch them directly use &startredirection and &endredirection
+@outputstack = ();
+$redirection = 0;
+
+#controls wheter the tag actually does
+$import = 1;
@extlinks=();
+# meta mode is a bit weird only some output is to be turned off
+#
';
+ }
+ my $editfooter=(<
+
+