--- loncom/xml/lonxml.pm 2005/11/10 21:28:21 1.387 +++ loncom/xml/lonxml.pm 2005/11/15 16:38:12 1.389 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # XML Parser Module # -# $Id: lonxml.pm,v 1.387 2005/11/10 21:28:21 albertel Exp $ +# $Id: lonxml.pm,v 1.389 2005/11/15 16:38:12 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -418,6 +418,7 @@ sub inner_xmlparse { my $result; my $token; my $dontpop=0; + my $startredirection = $Apache::lonxml::redirection; while ( $#$pars > -1 ) { while ($token = $$pars['-1']->get_token) { if (($token->[0] eq 'T') || ($token->[0] eq 'C') ) { @@ -528,10 +529,9 @@ sub inner_xmlparse { # } if ($target eq 'grade') { &endredirection(); } - if ( $Apache::lonxml::redirection ) { - &error("Unclean exit of parser, text still being redirected. This is likely due to there being missing end tags."); - while ($Apache::lonxml::redirection) { - $finaloutput.=&endredirection(); + if ( $Apache::lonxml::redirection > $startredirection) { + while ($Apache::lonxml::redirection > $startredirection) { + $finaloutput .= &endredirection(); } } if (($ENV{'QUERY_STRING'}) && ($target eq 'web')) { @@ -1456,7 +1456,12 @@ sub debug { if ($Apache::lonxml::debug eq "1") { $|=1; my $request=$Apache::lonxml::request; - if (!$request) { $request=Apache->request; } + if (!$request) { + eval { $request=Apache->request; }; + } + if (!$request) { + eval { $request=Apache2::RequestUtil->request; }; + } $request->print('
DEBUG:'.&HTML::Entities::encode($_[0],'<>&"')."
\n"); #&Apache::lonnet::logthis($_[0]); }