Whenever I try to render one or more problems in the homework sets editor on my webwork server, I get the error "mismatched tag at line 55, column 2, byte 2180 at /usr/lib64/perl5/XML/Parser.pm line 187" followed by a long HTML document. It works fine to display problems in a new window however. Can anyone suggest what the problem might be, or how I could get more information to help determine the problem?
I've made some progress on this. In /opt/webwork/webwork2/htdocs/themes/math4/system.template and .../gateway.template, the fourth and fifth lines are
<meta charset='utf-8'>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
These tags are missing a closing tag, causing the XML parser to report an error when it hits the </head> while still expecting a </meta>. They should end with "/>" instead of ">".
Furthermore, on line 129 of system.template there is a <script> block that should be escaped with //<![CDATA[ ... //]>; otherwise the XML parser chokes on that too.
(I'm puzzled that no one else has run into these problems. Is my XML parser more stringent than everyone else's for some reason?)
Unfortunately I am still stuck; now I am getting a different error message "wrong element 'html'", without any indication of where the error is coming from, making it rather harder to track down. Any suggestions would be very welcome...
<meta charset='utf-8'>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
These tags are missing a closing tag, causing the XML parser to report an error when it hits the </head> while still expecting a </meta>. They should end with "/>" instead of ">".
Furthermore, on line 129 of system.template there is a <script> block that should be escaped with //<![CDATA[ ... //]>; otherwise the XML parser chokes on that too.
(I'm puzzled that no one else has run into these problems. Is my XML parser more stringent than everyone else's for some reason?)
Unfortunately I am still stuck; now I am getting a different error message "wrong element 'html'", without any indication of where the error is coming from, making it rather harder to track down. Any suggestions would be very welcome...
It sounds like you are trying to use XHTML for your template. I'm afraid you are not going to be successful at that, because the HTML produced by much of WeBWorK is not XHTML, and it would be a massive project to get it to be. While most of the framework puts out HTML that could be used in XHTML, the macros and problems don't. For example, the
I recommend setting your DOCTYPE to
$PAR
macro in problems puts out a <p>
tag, but there is no matching </p
, and there is no easy way to fix that. And as you found, those that insert scripts, don't use //
since script tags are automatically CDATA in HTML (but not XHTML).I recommend setting your DOCTYPE to
<DOCTYPE html>
, and not trying to do XHTML. That is a losing battle.
Nope, not what I'm doing. The DOCTYPE is still html.
I had a guess last night that maybe what's happening is that webwork is trying to use some sort of internal XML communication, but something is going wrong and it's getting a full HTML response where it expected just an XML snippet. Could that be it?
I had a guess last night that maybe what's happening is that webwork is trying to use some sort of internal XML communication, but something is going wrong and it's getting a full HTML response where it expected just an XML snippet. Could that be it?
Sorry, I didn't see your original message abut the error message from
I don't see any reason the
XML::Parser
. The only place that I see XML::Parser
being used is in webwork2/lib/WeBWorK/Utils/DBImportExport.pm
, and that is in the code for importing a course database. So I don't see where this error could be coming from in the homework sets editor. Is there more to the error message (like a complete stack trace, perhaps farther down on the page)? Can you give us the top portion of the HTML file that is being reported with the message? Can you give a more precise statement of what actions cause this message?I don't see any reason the
XML::Parser
code should be processing the system.template
file.
Here's the rest of the stack trace. The error that I quoted is followed by a display of the "welcome to webwork" front page, complete with header and footer, and then:
at /opt/webwork/webwork2/lib/WebworkClient.pm line 195. End Errors
at /opt/webwork/webwork2/lib/WebworkClient.pm line 195. End Errors
WeBWorK error
An error occured while processing your request. For help, please send mail to this site's webmaster (root@localhost), including all of the following information as well as what what you were doing when the error occured.
Wed Apr 06 15:28:26 2016
Warning messages
Error messages
Can't call method "result" on an undefined value at /opt/webwork/webwork2/lib/WebworkClient.pm line 200.
Call stack
The information below can help locate the source of the problem.
in WebworkClient::xmlrpcCall called at line 319 of /opt/webwork/webwork2/lib/WeBWorK/ContentGenerator/instructorXMLHandler.pm
in WeBWorK::ContentGenerator::instructorXMLHandler::pre_header_initialize called at line 184 of /opt/webwork/webwork2/lib/WeBWorK/ContentGenerator.pm
in WeBWorK::ContentGenerator::go called at line 382 of /opt/webwork/webwork2/lib/WeBWorK.pm
The trouble might be in the xmlrpc rendering path, which does do some internal xml communication. However, as far as I know that rendering path doesn't use system.template. So there must be something else going on.
First, on which page exactly are you having trouble. Is it via the render button on the Problem Set Detail 2 page, or viewing a problem in the PG Problem Editor 2, or viewing a problem in the PG Problem Editor 3?
Second, could you find out what version your XML::Parser module is. The command
perl -MXML::Parser -e 'print $XMarser::VERSION."\n"';
should do it.
Third, do you have access to another WeBWorK server use can use to make sure that the problems you are rendering do render correctly.
First, on which page exactly are you having trouble. Is it via the render button on the Problem Set Detail 2 page, or viewing a problem in the PG Problem Editor 2, or viewing a problem in the PG Problem Editor 3?
Second, could you find out what version your XML::Parser module is. The command
perl -MXML::Parser -e 'print $XMarser::VERSION."\n"';
should do it.
Third, do you have access to another WeBWorK server use can use to make sure that the problems you are rendering do render correctly.
What about my suggestion that the xmlrpc path is mistakenly receiving a full HTML response -- produced using system.template -- instead of the XML snippet that it's expecting? That would also explain why the webwork front page is displaying in the middle of the error message.
This happens in two places: (1) when I select subjects, chapters, etc. in the Library Browser, and (2) when editing a single homework set and I click either "Render All" or the "Render Problem" button on a single problem.
My XML::Parser version is 2.36.
I do not have easy access to another webwork server, but I am confident that the problems render correctly on their own, because (1) they are unmodified from the OPL, and (2) they render correctly when I show them in a separate tab.
This happens in two places: (1) when I select subjects, chapters, etc. in the Library Browser, and (2) when editing a single homework set and I click either "Render All" or the "Render Problem" button on a single problem.
My XML::Parser version is 2.36.
I do not have easy access to another webwork server, but I am confident that the problems render correctly on their own, because (1) they are unmodified from the OPL, and (2) they render correctly when I show them in a separate tab.
I think this error does involve the AJAX callbacks used by Library Browser and Homework Sets.
There may be additional error messages in the Apache error_log which will help with tracking this down.
The long thread at http://webwork.maa.org/moodle/mod/forum/discuss.php?d=3022 discusses this problem which often results from an incorrect callback address for the AJAX calls. (search for "result" on the page)
Check the value $server_root_url = in webwork2/conf/site.conf -- make sure it is exactly correct.
No guarantee that is the problem, but it often has been in the past.
Ah, that was it!! The server_root_url had http when it should be https. Thanks very much.