Moodle XMLフォーマット
作成中です - Mitsuhiro Yoshida 2008年7月23日 (水) 12:12 (CDT)
XMLの妥当性について
XMLパーサー (構文解析ツール) は、XMLファイルが正しいと見做し、エラーを検査および報告しません。XMLファイルが正しくない場合、予想外のエラーが発生する可能性が大きくなります。あなたがXMLファイルを手書きで作成している場合、Moodleにインポートする前に、XML検査ツール等で構文をチェックすることを強くお勧めします。特に埋め込みHTMLフラグメントは、CDATAセクションに入れるよう、注意してください。
XMLファイルの全体構造
ファイルは次のようにタグで囲まれます。
<?xml version=1.0?>
<quiz>
.
.
.
</quiz>
<quiz>タグの中には、いくつでも<question>タグを入れることができます。<question>タグには、インポートおよびエクスポートを指定するため、以下のようにダミーのタイプ「category」を入れることができます。
<question type="category">
<category>
tom/dick/harry
</category>
</question>
ファイルは、 UTF8にエンコードしてください。
Moodle XMLインポートおよびエクスポートは、機能性においてバランスがとられています。ですから、フォーマットを理解するためには、単純にいくつかの問題を作成してエクスポートした後、エクスポートされたファイルがどのようになっているか確認してください。
すべての問題タイプに共通するタグ
問題は以下のように記述します。
<question type="multichoice|truefalse|shortanswer|match|cloze|essay|numerical|description">
<questiontext format="html">
この問題の答えは何でしょうか?
</questiontext>
.
.
.
</question>
「Format」では、問題テキストのフォーマットオプションを選択してください。オプションには、moodle_auto_format (デフォルト)、html、plain_text、markdownがあります。オプションの選択は、テキストの表示方法に影響します。
さらに少なくとも通常1つは含まれるタグは、<answer>タグです。以下、ドットがマークされたタグは、<question>タグの子ノードとして使用されます。レスポンスに関連したタグは、このページの下部に記述されています。様々な (任意?) のタグを使用することもできます。
- penalty
- generalfeedback
- defaultgrade
- hidden
<image>タグには、インクルードされたイメージのURIを含みます。<image>タグにネストする<image_base64>タグでは、base64にエンコードされた実データを含みます [1]。
一般的な問題の一部を示した次の問題タイプの例では、問題の明瞭さを改善することを目的としていません。完全な例を閲覧するため、あなた自身でいくつかの問題例をエクスポートしてください。
多肢選択問題
多肢選択問題では、それぞれの選択肢に<answer>タグを持ちます。それぞれの選択肢には、フィードバック (feedback) および (fraction属性を使用した) 評点の加重を持つことができます。加えて、多肢選択問題には次のタグを含むことができます:
- single (値: true/false)
- shuffleanswers (値: 1/0)
- correctfeedback
- partiallycorrectfeedback
- incorrectfeedback
- answernumbering (許可される値: 「abc」「ABC」または「123」)
<single>タグは、単一解答 (ラジオボタン) および複数解答 (チェックボックス) を区別するため使用されます。
<question type="multichoice"> <answer fraction="100"> <text>正解</text> <feedback><text>正解です!</text></feedback> </answer> <answer fraction="0"> <text>選択肢</text> <feedback><text>しまった!</text></feedback> </answer> <answer fraction="0"> <text>別の選択肢</text> <feedback><text>しまった!</text></feedback> </answer> <shuffleanswers>1</shuffleanswers> <single>true</single> <answernumbering>abc</answernumbering>
○/×問題
○/×問題には、正解、不正解の2つの答えのタグがあります。答えのfraction属性タグで、どちらのオプションが正解 (100)、そしてどちらのオプションが不正解 (0) か特定します。フィードバックはサポートされています。次の例では「正解」が正しく、「不正解」が正しくない答えを表しています。
<question type="truefalse"> <answer fraction="100"> <text>正解</text> <feedback><text>正解です!</text></feedback> </answer> <answer fraction="0"> <text>不正解</text> <feedback><text>おやおや!</text></feedback> </answer>
記述問題
記述問題タイプでは、それぞれに独自の加重およびフィードバックを持った正答の選択肢をサポートします。Moodle XMLフォーマットは、それぞれの正答の選択肢に1つの<answer>タグを使用します。
<usecase>タグの値 (1または0) を使用して、大文字小文字の区別をするかどうか設定します。
<question type="shortanswer">
<answer fraction="100">
正答
<feedback>正解です!</feedback>
</answer>
<question type="shortanswer">
<answer fraction="100">
正答
<feedback>正解です!</feedback>
</answer>
<answer fraction="100">
答えの選択肢
<feedback>正解です!</feedback>
</answer>
数値問題
以下の例は、数値問題のMoodle XMLフォーマットを簡易化したものです。
<question type="numerical"> <answer fraction="100"> <text>23</text> <feedback><text>フィードバック</text></feedback> </answer>
Moodle also supports a <tolerance> tag (how accurate must the number be?) and one or more <unit> tags. Unit tags have names and multipliers. E.g. if the main answer is in kilometres, an additional answer could be the equivalent in metres with a multiplier of 1000.
Note: prior to 1.7.2 the fraction was expressed as a value between 0 and 1 in a <fraction> element and the answer value was not enclosed in <text> tags. This format of the numerical question type is deprecated but will still be correctly imported if found (for now).
組み合わせ問題
Pair matching responses use the <shuffleanswers> tag to determine whether the order of the items should be randomized. Each pair is contained inside a <subquestion> tag. The first item of each pair is contained with a <text> tag, while the second has an <answer> tag around it as well. Feedback and score weighting is not supported by Moodle for this response type.
<question type="match"> <subquestion> <text>This is the 1st item in the 1st pair.</text> <answer> <text>This is the 2nd item in the 1st pair.</text> </answer> </subquestion> <subquestion> <text>This is the 1st item in the 2nd pair.</text> <answer> <text>This is the 2nd item in the 2nd pair.</text> </answer> </subquestion> <shuffleanswers>true</shuffleanswers>
作文問題
An example of the essay type question...
<question type="essay"> <answer fraction="0"> <text></text> </answer> </question>
There isn't an answer and there isn't a grade in this case.
Note: prior to 1.7.2 the fraction was expressed as a value between 0 and 1 in a <fraction> element and the answer value was not enclosed in <text> tags. This format of the essay question type is deprecated but will still be correctly imported if found (for now).
その他の問題タイプ
穴埋め問題 (Cloze)
It is supported, and depends on a special format for the <questiontext> tag.
説明タイプ
This response type has no further tags other than those contained in the question header (such as <questiontext>).
ランダム記述組み合わせ問題
Moodle has a question type which consists of taking short answer questions in the same quiz and displaying them as a pair matching exercise. However Moodle is neither able to export nor import this question type.
ヒント
Moodle XMLを生成するMicrosoft Wordのテンプレートです [2]。- 英語