mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 00:46:50 +02:00
MDL-36942 xml question import: don't add spaces.
They are not necessary anyway, there is a \n character at the end of each line. Thanks to Richard Lobb for fining the problem and how to fix it.
This commit is contained in:
parent
47dfbd9eb3
commit
7e252acff1
1 changed files with 4 additions and 3 deletions
|
@ -905,17 +905,18 @@ class qformat_xml extends qformat_default {
|
||||||
*/
|
*/
|
||||||
protected function readquestions($lines) {
|
protected function readquestions($lines) {
|
||||||
// We just need it as one big string
|
// We just need it as one big string
|
||||||
$text = implode($lines, ' ');
|
$lines = implode('', $lines);
|
||||||
unset($lines);
|
|
||||||
|
|
||||||
// This converts xml to big nasty data structure
|
// This converts xml to big nasty data structure
|
||||||
// the 0 means keep white space as it is (important for markdown format)
|
// the 0 means keep white space as it is (important for markdown format)
|
||||||
try {
|
try {
|
||||||
$xml = xmlize($text, 0, 'UTF-8', true);
|
$xml = xmlize($lines, 0, 'UTF-8', true);
|
||||||
} catch (xml_format_exception $e) {
|
} catch (xml_format_exception $e) {
|
||||||
$this->error($e->getMessage(), '');
|
$this->error($e->getMessage(), '');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
unset($lines); // No need to keep this in memory.
|
||||||
|
|
||||||
// Set up array to hold all our questions
|
// Set up array to hold all our questions
|
||||||
$questions = array();
|
$questions = array();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue