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

albertel lon-capa-cvs@mail.lon-capa.org
Wed, 14 Sep 2005 19:20:25 -0000


albertel		Wed Sep 14 15:20:25 2005 EDT

  Modified files:              
    /loncom/xml	lonxml.pm 
  Log:
  - preserver CDATA sections as such
  
  
Index: loncom/xml/lonxml.pm
diff -u loncom/xml/lonxml.pm:1.381 loncom/xml/lonxml.pm:1.382
--- loncom/xml/lonxml.pm:1.381	Sun Jul 10 17:43:35 2005
+++ loncom/xml/lonxml.pm	Wed Sep 14 15:20:23 2005
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # XML Parser Module 
 #
-# $Id: lonxml.pm,v 1.381 2005/07/10 21:43:35 www Exp $
+# $Id: lonxml.pm,v 1.382 2005/09/14 19:20:23 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -893,7 +893,11 @@
     $tag='<'.$tag.'>';
     while ($token = $$pars[-1]->get_token) {
 	if (($token->[0] eq 'T')||($token->[0] eq 'C')||($token->[0] eq 'D')) {
-	    $result.=$token->[1];
+	    if ($token->[2]) {
+		$result.='<![CDATA['.$token->[1].']]>';
+	    } else {
+		$result.=$token->[1];
+	    }
 	} elsif ($token->[0] eq 'PI') {
 	    $result.=$token->[2];
 	} elsif ($token->[0] eq 'S') {
@@ -959,7 +963,11 @@
 	    while (($depth >=0) && ($token = $$pars[-1]->get_token)) {
 		#&Apache::lonxml::debug("e token:$token->[0]:$depth:$token->[1]:".$#$pars.":".$#Apache::lonxml::pwd);
 		if (($token->[0] eq 'T')||($token->[0] eq 'C')||($token->[0] eq 'D')) {
-		    $result.=$token->[1];
+		    if ($token->[2]) {
+			$result.='<![CDATA['.$token->[1].']]>';
+		    } else {
+			$result.=$token->[1];
+		    }
 		} elsif ($token->[0] eq 'PI') {
 		    $result.=$token->[2];
 		} elsif ($token->[0] eq 'S') {
@@ -1011,7 +1019,11 @@
 		#&Apache::lonxml::debug("s token:$token->[0]:$depth:$token->[1]");
 		if (($token->[0] eq 'T')||($token->[0] eq 'C')||
 		    ($token->[0] eq 'D')) {
-		    $result.=$token->[1];
+		    if ($token->[2]) {
+			$result.='<![CDATA['.$token->[1].']]>';
+		    } else {
+			$result.=$token->[1];
+		    }
 		} elsif ($token->[0] eq 'PI') {
 		    $result.=$token->[2];
 		} elsif ($token->[0] eq 'S') {