Note: You are currently viewing documentation for Moodle 2.3. Up-to-date documentation for the latest stable version is available here: Frank Ralf/Moodle XML1.

User:Frank Ralf/Moodle XML1: Difference between revisions

From MoodleDocs
Line 25: Line 25:


[[Image:Moodle XML Minimum question.png]]
[[Image:Moodle XML Minimum question.png]]
=== Re-export ===
This is how the question looks after exporting it again:
<code xml>
<?xml version="1.0" encoding="UTF-8"?>
<quiz>
<!-- question: 35  -->
  <question type="shortanswer">
    <name>
      <text>Minimum question</text>
    </name>
    <questiontext format="moodle_auto_format">
      <text>What's the minimum XML required for import?</text>
    </questiontext>
    <image></image>
    <generalfeedback>
      <text></text>
    </generalfeedback>
    <defaultgrade>1</defaultgrade>
    <penalty>0.1</penalty>
    <hidden>0</hidden>
    <shuffleanswers>0</shuffleanswers>
    <usecase>0</usecase>
    <answer fraction="100">
      <text>This here!</text>
      <feedback>
        <text></text>
      </feedback>
    </answer>
</question>
</quiz>
</code>

Revision as of 15:32, 5 October 2009

This is only for keeping notes on some of my findings regarding Moodle XML.

Minimum XML

Other than stated at Quedoc's Moodle XML documentation (Minimum requirements) the minimum working Moodle XML file seems to be the following (short answer question). It gets imported using the default import settings.

Missing fields are populated with the default values during import which can be seen by re-exporting the question(s).

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

 <question type="shortanswer">
   <name>
     <text>Minimum question</text>
   </name>
   <questiontext>
     <text>What's the minimum XML required for import?</text>
   </questiontext>
   <answer fraction="100">
     <text>This here!</text>
   </answer>

</question> </quiz>

Moodle XML Minimum question.png


Re-export

This is how the question looks after exporting it again:

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

 <question type="shortanswer">
   <name>
     <text>Minimum question</text>
   </name>
   <questiontext format="moodle_auto_format">
     <text>What's the minimum XML required for import?</text>
   </questiontext>
   <image></image>
   <generalfeedback>
     <text></text>
   </generalfeedback>
   <defaultgrade>1</defaultgrade>
   <penalty>0.1</penalty>
   <hidden>0</hidden>
   <shuffleanswers>0</shuffleanswers>
   <usecase>0</usecase>
    <answer fraction="100">
     <text>This here!</text>
     <feedback>
       <text></text>
     </feedback>
   </answer>

</question> </quiz>