Error on importing XML file

Error on importing XML file

per Christian Eckhardt -
Nombre de respostes: 10
Hello,

I am writing a program that generates English grammar exercises with feedback from a database. The output is an xml file that I want to import into quiz, unfortunately moodle just says there is a mistake in it but doesn't give any further detail and I can't find the mistake myself. Could any one help me with that, please?

Here is the code that failed:

------------------------------------------------------

<?xml version="1.0" encoding="UTF-8"?>
<quiz>

<question type="shortanswer">
<name><text>Exercise 1, task no. 3</text></name>
<questiontext format="html"><text><![CDATA[<p></p><span style="font-size:140%;color:navy;font-weight:bold;"><p>I {1:SHORTANSWER:~=have seen#Correct!~%0%has seen#The auxuliary is in the wrong form.~%0%have see#For the present perfect you need the <b>third</b> form of the verb.~%0%have saw#This is the wrong form of the irregular verb. You need the <b>third</b> form of the verb.~%0%has saw#This is the wrong form of the irregular verb. You need the <b>third</b> form of the verb. - The auxuliary is in the wrong form.} (see) John several times today.</p></span>]]></text>
</questiontext>
<generalfeedback><text></text></generalfeedback>
<shuffleanswers>0</shuffleanswers>
</question>



<question type="cloze">
<name><text>Exercise 1, task no. 5</text></name>
<questiontext format="html">
<text><![CDATA[He {1:SHORTANSWER:~=plays#Correct!~%0%play#<i>He, she, it,</i>, das <b>s</b> muss mit!} (play) the flute and she {1:SHORTANSWER:~=tries#Correct!} (try) to learn singing.]]></text>
</questiontext>
<generalfeedback><text></text></generalfeedback>
<shuffleanswers>0</shuffleanswers>
</question>



<question type="cloze">
<name><text>Exercise 1, task no. 5</text></name>
<questiontext format="html">
<text><![CDATA[We {1:SHORTANSWER:~=went#Correct!~%0%goed#This is an irregular verb.~%0%gone#This is the wrong form of the irregular verb. You need the <b>second</b> form of the verb.} to the zoo yesterday but we {1:SHORTANSWER:~=didn't see#Correct!~=didn´t see#Correct!~=didn`t see#Correct!} (not see) any lions.]]></text>
</questiontext>
<generalfeedback><text></text></generalfeedback>
<shuffleanswers>0</shuffleanswers>
</question>



</quiz>

Mitjana de qualificacions: -
En resposta a Christian Eckhardt

Re: Error on importing XML file

per Joseph Rézeau -
Imatge Core developers Imatge Plugin developers Imatge Testers Imatge Translators

Hi Christian,

There were 2 errors in your xml file:

<question type="shortanswer">

<name><text>Exercise 1, task no. 3</text></name>

shoud be

<question type="cloze">

<name><text>Exercise 1, task no. 3</text></name>

and the questions import module does not accept the "weird" apostrophes you put in:

didn´t see#Correct!~=didn`t see


Joseph

En resposta a Joseph Rézeau

Re: Error on importing XML file

per Christian Eckhardt -
Dear Joseph,

thanks for your immediate help. It works fine now. However, I put the "weird apostrophes" in deliberately because learners with a German keyboard tend to use these instead of the proper one. So the idea behind that was to make the quiz more tolerant to machine-specific mistakes. Is there any way in way in which I can avoid that problem? - Telling the pupils being the most obvious solution seems to help only partly.

Another point I'd like to make is that I prefer the shortanswer question-type whereever possible because it gives obvious feedback. Is there any way to make cloze show the feedback by automatically opening the pop-ups whenever there is some feedback available? I'd really appreciate that very much.

Best, Chris
En resposta a Christian Eckhardt

S'ha suprimit aquest missatge del fòrum

El contingut del missatge al fòrum s'ha suprimit i ja no hi podeu accedir.
En resposta a Christian Eckhardt

Re: Error on importing XML file

per Tim Hunt -
Imatge Core developers Imatge Documentation writers Imatge Particularly helpful Moodlers Imatge Peer reviewers Imatge Plugin developers
If you are using "weird apostrophes" then you need to make sure your XML file is in the UTF-8 character encoding.
En resposta a Tim Hunt

Re: Error on importing XML file

per Joseph Rézeau -
Imatge Core developers Imatge Plugin developers Imatge Testers Imatge Translators
No, even an xml file encoded in UTF-8 throws an error upon import if it contains the weird apostrophes.
Joseph
En resposta a Joseph Rézeau

Re: Error on importing XML file

per Tim Hunt -
Imatge Core developers Imatge Documentation writers Imatge Particularly helpful Moodlers Imatge Peer reviewers Imatge Plugin developers
Oh, well that is a bug. Please file it in the tracker.
En resposta a Tim Hunt

Re: Error on importing XML file

per Christian Eckhardt -
I'd do it because I'm interested in seeing that fixed but I don't know how to. I'd be pleased if somebody else could file the bug. Thanks.

How do I get to know when the bug is fixed? Will it be in the general update for Moodle as a whole? Or maybe only in a quiz-module update?

Thanks in advance - and of course for the help so far.
En resposta a Christian Eckhardt

S'ha suprimit aquest missatge del fòrum

El contingut del missatge al fòrum s'ha suprimit i ja no hi podeu accedir.
En resposta a Christian Eckhardt

S'ha suprimit aquest missatge del fòrum

El contingut del missatge al fòrum s'ha suprimit i ja no hi podeu accedir.
En resposta a S'ha esborrat l'usuari

Re: Error on importing XML file

per Christian Eckhardt -
Hello,

I have tested it again and it works fine due to a change that seemed unimportant to me.

The <?xml version="1.0" encoding="UTF-8"?> was not exactly the first line but preceeded by an empty line.

Can an empty line really cause that? If so, this should clearly be pointed out in the documentation. Maybe it's something rather natural for professional programmers but not so for me.