--- loncom/xml/lonxml.pm 2008/02/15 12:59:50 1.471 +++ loncom/xml/lonxml.pm 2008/03/07 20:49:17 1.472 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # XML Parser Module # -# $Id: lonxml.pm,v 1.471 2008/02/15 12:59:50 bisitz Exp $ +# $Id: lonxml.pm,v 1.472 2008/03/07 20:49:17 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -1475,11 +1475,26 @@ SIMPLECONTENT return $filecontents; } +sub verify_html { + my ($filecontents)=@_; + if ($filecontents!~/(?:\<|\<\;)(?:html|xml)[^\<]*(?:\>|\>\;)/is) { + return &mt('File does not have [_1] or [_2] starting tag','<html>','<xml>'); + } + if ($filecontents!~/(?:\<|\<\;)\/(?:html|xml)(?:\>|\>\;)/is) { + return &mt('File does not have [_1] or [_2] ending tag','<html>','<xml>'); + } + if ($filecontents!~/(?:\<|\<\;)(?:body|frameset)[^\<]*(?:\>|\>\;)/is) { + return &mt('File does not have [_1] or [_2] starting tag','<body>','<frameset>'); + } + if ($filecontents!~/(?:\<|\<\;)\/(?:body|frameset)[^\<]*(?:\>|\>\;)/is) { + return &mt('File does not have [_1] or [_2] ending tag','<body>','<frameset>'); + } + return ''; +} sub inserteditinfo { my ($filecontents, $filetype, $filename)=@_; $filecontents = &HTML::Entities::encode($filecontents,'<>&"'); -# my $editheader='Edit below