Importing questions using the xml format

Importing questions using the xml format

by Fernando Flores -
Number of replies: 8

Hi everyone, I am new here!


I have a problem importing some questions to moodle using the xml extension... I suspect the problem is related to two "cloze" type questions in the same folder... I can't attach the files since they are too large... but I can provide a link to them.

https://drive.google.com/open?id=1yw5S7oOWPSzOuMFc5v55q7vXGpvWUbsW


I need to import those question in the same folder... but I don't know what the problem really is... Can someone help me? Thanks in advance!

Average of ratings: -
In reply to Fernando Flores

Re: Importing questions using the xml format

by Jean-Michel Védrine -

Hello Fernando,

Can you tell me what Moodle version you are using ?

Your files are not that big (I successfully imported quite bigger xml questions files) but the 2 cloze questions (and the ddimageortext one) contains big images (animations, and I must admit that I don't understand at all what they represent big grin)

I ask this because there have been important improvements in the import of xml in Moodle recent versions so if you are using an older Moodle version that may be part of the problem.

Also if you are able to do that it would be interesting to set debugging level to DEVELOPER (see https://docs.moodle.org/37/en/Debugging) and try to import the files again to see if you get an error message.

When you say that you want the 2 cloze questions "in the same folder" I suppose you want them in the same question category.

There are at least 2 ways to do that

  • first way is to import the 2 files as usual so the questions would be in 2 different categories "Membranas. Estructura e importancia" and "Núcleo y transporte nuclear" then after that edit the questions to change the categories to suit your requirements. I did that and had no problem with your questions.
  • the second way is to import the 2 files in the same category, to do that during each xml import, you expand the "General" section on the import page and uncheck the "get category from file" checkbox. I also tried that and had no problem.

Just a short note that for all my tests I created several xml files from your own files each one with just a question so that I can tell if something go wrong what was the question having a problem (and also because I made my tests on a shared server with very few resources), and I was able to import successfully all the questions. If you want I can send you all these files so you can see if it makes a difference trying to import questions one by one.

Average of ratings:Useful (2)
In reply to Jean-Michel Védrine

Re: Importing questions using the xml format

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators
I confirm what Jean-Michel wrote above. I have had no problem importing your questions to my local Moodle test site running Moodle 3.7.
Average of ratings:Useful (1)
In reply to Joseph Rézeau

Re: Importing questions using the xml format

by Fernando Flores -
Hmmm interesting, A fellow teacher of mine tried to import my file using the same version of moodle at the university and the same problem happened to him.
In reply to Jean-Michel Védrine

Re: Importing questions using the xml format

by Fernando Flores -

Can you tell me what Moodle version you are using ?

I really don't know to be honest...


When you say that you want the 2 cloze questions "in the same folder" I suppose you want them in the same question category.

Yeah, sorry, that was what I meant. Every time those two cloze question are in the same category or imported under a higher hierarchy one, the same problem happens sad




It basically says: "Error importing error Error analyzing XML: No memory in line 679, character 8.


  • first way is to import the 2 files as usual so the questions would be in 2 different categories "Membranas. Estructura e importancia" and "Núcleo y transporte nuclear" then after that edit the questions to change the categories to suit your requirements. I did that and had no problem with your questions.

This does work, but I want to send them together if I can.

  • the second way is to import the 2 files in the same category, to do that during each xml import, you expand the "General" section on the import page and uncheck the "get category from file" checkbox. I also tried that and had no problem.
This does not work for me unfortunately...


If you want I can send you all these files so you can see if it makes a difference trying to import questions one by one.

Yes please!!!


And thanks again for taking the time helping me smile

In reply to Fernando Flores

Re: Importing questions using the xml format

by Germán Valero -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators
You can easily find out your Moodle version, even if you are nor an admin and your site is not in English.
Average of ratings:Useful (2)
In reply to Germán Valero

Re: Importing questions using the xml format

by Fernando Flores -

I went to the bottom of my moodle page and I didn't find anything that looked like what the link you provided suggested me to look for. sad



In reply to Jean-Michel Védrine

Re: Importing questions using the xml format

by Fernando Flores -
I received the email with the 3 attachments, thank you very much! smile