「Moodle XMLフォーマット」の版間の差分

提供:MoodleDocs
移動先:案内検索
43行目: 43行目:
「Format」では、問題テキストの[[フォーマットオプション]]を選択してください。オプションには、'''moodle_auto_format''' (デフォルト)、'''html'''、'''plain_text'''、'''markdown'''があります。オプションの選択は、テキストの表示方法に影響します。
「Format」では、問題テキストの[[フォーマットオプション]]を選択してください。オプションには、'''moodle_auto_format''' (デフォルト)、'''html'''、'''plain_text'''、'''markdown'''があります。オプションの選択は、テキストの表示方法に影響します。


さらに少なくとも通常1つは含まれるタグは、<answer>タグです。
さらに少なくとも通常1つは含まれるタグは、<answer>タグです。以下、ドットがマークされたタグは、<question>タグの子ノードとして使用されます。The response-related tags are listed further down on this page. Various (optional?) tags are possible.  
Further tags, which usually include at least one <answer> tag, follow in the space marked with dots as child nodes to the <question> tag. The response-related tags are listed further down on this page. Various (optional?) tags are possible.  


* penalty
* penalty

2008年7月29日 (火) 15:07時点における版

作成中です - 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">
        <text>この問題の答えは何でしょうか?</text>
    </questiontext>
    .
    .
    .
</question>

「Format」では、問題テキストのフォーマットオプションを選択してください。オプションには、moodle_auto_format (デフォルト)、htmlplain_textmarkdownがあります。オプションの選択は、テキストの表示方法に影響します。

さらに少なくとも通常1つは含まれるタグは、<answer>タグです。以下、ドットがマークされたタグは、<question>タグの子ノードとして使用されます。The response-related tags are listed further down on this page. Various (optional?) tags are possible.

  • penalty
  • generalfeedback
  • defaultgrade
  • hidden

The <image> tag contains the url of any included image. Nested within the <image> tag may be an <image_base64> tag which contains the actual image data encoded in base64 [1].

In the following question type examples the common parts of the question are not shown to improve clarity. It's a good idea to export some examples yourself to see a full example.

多肢選択問題

MC questions have one <answer> tag for each choice. Each choice can carry feedback and score weighting (by using the fraction attribute). In addition, an MC question has the following tags:

  • single (values: true/false)
  • shuffleanswers (values: 1/0)
  • correctfeedback
  • partiallycorrectfeedback
  • incorrectfeedback
  • answernumbering (allowed values: 'abc', 'ABC' or '123')

The <single> tag is used to distinguish single response (radio button) and multiple response (checkbox) variants.

<question type="multichoice">
<answer fraction="100">
    <text>The correct answer</text>
   <feedback><text>Correct!</text></feedback>
</answer>
<answer fraction="0">
    <text>A distractor</text>
   <feedback><text>Ooops!</text></feedback>
</answer>
<answer fraction="0">
    <text>Another distractor</text>
   <feedback><text>Ooops!</text></feedback>
</answer>
<shuffleanswers>1</shuffleanswers>
<single>true</single>
<answernumbering>abc</answernumbering>

○/×問題

Two answer tags are given, one which is true, and one which is false. The fraction attribute of the answer tag identifies which option is correct (100) and which is false (0). Feedback is supported. The following example shows the format when true is the correct answer and false is wrong.

<question type="truefalse">
<answer fraction="100">
   <text>true</text>
   <feedback><text>Correct!</text></feedback>
</answer>
<answer fraction="0">
   <text>false</text>
   <feedback><text>Ooops!</text></feedback>
</answer>

記述問題

The short answer question type supports alternative correct responses, each with its own weighting and feedback. The Moodle XML format uses one <answer> tag for each of the alternative correct answers.

The <usecase> tag toggles case-sensitivity with the values 1/0.

<question type="shortanswer">
<answer fraction="100">
    <text>The correct answer</text>
    <feedback><text>Correct!</text></feedback>
</answer>
<question type="shortanswer">
<answer fraction="100">
    <text>The correct answer</text>
    <feedback><text>Correct!</text></feedback>
</answer>
<answer fraction="100">
    <text>An alternative answer</text>
    <feedback><text>Correct!</text></feedback>
</answer>

数値問題

The following is a simplified version of the Moodle XML format for numerical responses.

<question type="numerical">
<answer fraction="100">
    <text>23</text>
    <feedback><text>Feedback</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]。- 英語

関連情報