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

albertel lon-capa-cvs@mail.lon-capa.org
Mon, 13 Jan 2003 22:20:35 -0000


albertel		Mon Jan 13 17:20:35 2003 EDT

  Modified files:              (Branch: version_0_6)
    /loncom/xml	lonxml.pm 
  Log:
  - backport of 1.224 (Fixes bug # 1139)
  
  
Index: loncom/xml/lonxml.pm
diff -u loncom/xml/lonxml.pm:1.221.2.1 loncom/xml/lonxml.pm:1.221.2.2
--- loncom/xml/lonxml.pm:1.221.2.1	Thu Jan  9 17:45:50 2003
+++ loncom/xml/lonxml.pm	Mon Jan 13 17:20:35 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # XML Parser Module 
 #
-# $Id: lonxml.pm,v 1.221.2.1 2003/01/09 22:45:50 albertel Exp $
+# $Id: lonxml.pm,v 1.221.2.2 2003/01/13 22:20:35 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -771,7 +771,7 @@
       if ($token->[0] eq 'E') { 
 	&end_tag($stack,$parstack,$token);
       }
-    }
+    }	
     if ($#$pars > -1) {
 	pop @$pars;
 	pop @Apache::lonxml::pwd;
@@ -1113,7 +1113,9 @@
 sub get_all_text {
  my($tag,$pars)= @_;
  &Apache::lonxml::debug("Got a ".ref($pars));
+ my $gotfullstack=1;
  if (ref($pars) ne 'ARRAY') {
+     $gotfullstack=0;
      $pars=[$pars];
  }
  my $depth=0;
@@ -1145,7 +1147,16 @@
        pop(@$pars);
        pop(@Apache::lonxml::pwd);
      }
-     if (($depth >=0) && ($#$pars == 0) ) { $top_empty=1; }
+     if (($depth >=0) && ($#$pars == 0) ) {        &debug("here4");$top_empty=1; }
+   }
+   if ($top_empty && $depth >= 0) {
+       #never found the end tag ran out of text, throw error send back blank
+       &error('Never found end tag for <'.$tag.'>');
+       if ($gotfullstack) {
+	   my $newstring='</'.$tag.'>'.$result;
+	   &Apache::lonxml::newparser($pars,\$newstring);
+       }
+       $result='';
    }
  } else {
      while ($#$pars > -1) {