What is the Totara XML format?
  • 21 Jun 2022
  • 2 minutes to read

What is the Totara XML format?


Article Summary

Totara XML is a specific file format used for the quiz activity in Totara Learn. It is based on the Moodle XML format developed within the Moodle community, but adapted to work with Totara quizzes. 

The following question types are supported by Totara XML format (and can be exported, imported or constructed using it):

  • Multiple choice
  • True/false
  • Short answer
  • Numerical response
  • Matching
  • Essay
  • Cloze
  • Description 

The Description question type is limited in what it can do, as it is intended as a space to add additional text. 

Common tags

There are some common tags that can be used when constructing a question using Totara XML.

TagFunction
<question type="">This opens the question and would include the desired question type between the quotation marks, such as: multichoice|truefalse|shortanswer|matching|cloze|essay|numerical|description. For example: <question type="truefalse">
</question>Closes the question at the end of the section. 
<name>Used to enter the name of the question, e.g. <name>Name of the question</name>. It is closed with the </name> tag. 
 <questiontext>Used to denote the actual question text, e.g. <questiontext>Is this a rhetorical question?</questiontext>. You can also use this tag to set the format (e.g. HTML, markdown, or plain text). This is done by including the format in the tag, e.g. <questiontext format="html">.
<answer>This denotes a possible answer to the question and follows the question text tag. You can also use the fraction attribute to indicate the correct answer, with 100 being assigned to the correct answer(s) and all other answers being assigned 0. For example:
<answer fraction="100">This is right</answer>
<answer fraction="0">This is wrong</answer>
<feedback>Use this tag within the answer tag to give feedback, for example:
<answer fraction="0">
              <text>This is wrong</text>
              <feedback><text>You got this wrong, try again</text></feedback>
</answer>

Example

<question type="multichoice">
<name> 
            <text> This is the question name </text>
</name>
<questiontext format="html">
              <text>Can you answer this question?</text>
</questiontext>
<answer fraction="100"><text>This is correct</text></answer>
<answer fraction="0"><text>This is wrong</text></answer>
<answer fraction="0"><text>This is also wrong</text></answer>
</question>

Multiple choice

The following tags are available for multiple choice quiz questions. 

TagFunction

<single>


This is used to determine whether there is a single response or multiple responses. Single responses will display with radio buttons, whereas multiple responses will use checkboxes. You can enter true (single) or false (multiple). For example: <single>true</single>
<shuffleanswers>This is used to determine if you wish to shuffle the answers (i.e. randomise their order) and can contain a value of 1 (shuffle) or 0 (don't shuffle). For example: <shuffleanswers>1</shuffleanswers>
<answernumbering>This allows you to set the numbering for answers. You can choose from: none, abc, ABCD, or 123. For example: <answernumbering>123</answernumbering>

Short answer

The following tag is available for short answer quiz questions.

TagFunction
<usecase>This is used to indicate if case sensitivity should be used, that is if the answers should be checked for their use of capitalisation. This tag can use the value 1 (case-sensitivity on) or 0 (case-sensitivity off). For example: <usecase>1</usecase>.

Matching

The following tags are available for matching quiz questions.

TagFunction

<subquestion>


Each matching pair is contained within a <subquestion> tag, with the first item in the pair using <text> tags and the second additionally using <answer> tags. For example:
<subquestion>

   <text>This is the 1st item in the pair.</text>

    <answer>

        <text>This is the 2nd item in the pair.</text>

    </answer>

</subquestion>

<shuffleanswers>This is used to determine if you wish to shuffle the answers, and can contain a value of 1 (shuffle) or 0 (don't shuffle). For example: <shuffleanswers>1</shuffleanswers>

© Copyright 2024 Totara Learning Solutions. All rights reserved.


Was this article helpful?

Changing your password will log you out immediately. Use the new password to log back in.
First name must have atleast 2 characters. Numbers and special characters are not allowed.
Last name must have atleast 1 characters. Numbers and special characters are not allowed.
Enter a valid email
Enter a valid password
Your profile has been successfully updated.