--- loncom/homework/cleanxml/xml_to_loncapa.pm 2016/01/05 18:51:08 1.4 +++ loncom/homework/cleanxml/xml_to_loncapa.pm 2016/01/06 16:44:32 1.5 @@ -1,7 +1,7 @@ # The LearningOnline Network # convert_file takes a well-formed XML file content and converts it to LON-CAPA syntax. # -# $Id: xml_to_loncapa.pm,v 1.4 2016/01/05 18:51:08 damieng Exp $ +# $Id: xml_to_loncapa.pm,v 1.5 2016/01/06 16:44:32 damieng Exp $ # # Copyright Michigan State University Board of Trustees # @@ -60,7 +60,10 @@ sub convert_file { my ($contents) = @_; my $dom_doc = XML::LibXML->load_xml(string => $contents); - add_outtext($dom_doc); + my $root = $dom_doc->documentElement(); + if (defined $root && $root->nodeName ne 'html') { + add_outtext($dom_doc); + } return node_to_string($dom_doc); }