Note: You are currently viewing documentation for Moodle 3.6. Up-to-date documentation for the latest stable version of Moodle is likely available here: Frank Ralf/Converting Moodle glossary XML to question XML.

User:Frank Ralf/Converting Moodle glossary XML to question XML

From MoodleDocs
< Frank Ralf
Revision as of 20:11, 24 November 2010 by Frank Ralf (talk | contribs) (New page: See [http://moodle.org/mod/forum/discuss.php?d=162866 Glossary items used in a quiz] == Glossary XML == <code xml> <?xml version="1.0" encoding="UTF-8" ?> <GLOSSARY> <INFO> <NAME>...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

See Glossary items used in a quiz

Glossary XML

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

 <INFO>
   <NAME>Animals</NAME> 
   <INTRO>A list of wild animals</INTRO> 
   <ALLOWDUPLICATEDENTRIES>0</ALLOWDUPLICATEDENTRIES> 
   <DISPLAYFORMAT>dictionary</DISPLAYFORMAT> 
   <SHOWSPECIAL>1</SHOWSPECIAL> 
   <SHOWALPHABET>1</SHOWALPHABET> 
   <SHOWALL>1</SHOWALL> 
   <ALLOWCOMMENTS>0</ALLOWCOMMENTS> 
   <USEDYNALINK>1</USEDYNALINK> 
   <DEFAULTAPPROVAL>1</DEFAULTAPPROVAL> 
   <GLOBALGLOSSARY>1</GLOBALGLOSSARY> 
   <ENTBYPAGE>10</ENTBYPAGE> 
   <ENTRIES>
     <ENTRY>
       <CONCEPT>Gorilla</CONCEPT> 
       <DEFINITION>Gorillas are the largest of the primates.</DEFINITION> 
       <FORMAT>0</FORMAT> 
       <USEDYNALINK>1</USEDYNALINK> 
       <CASESENSITIVE>0</CASESENSITIVE> 
       <FULLMATCH>0</FULLMATCH> 
       <TEACHERENTRY>1</TEACHERENTRY> 
     </ENTRY>
   </ENTRIES>
 </INFO>

</GLOSSARY>

Note

The tag names have to be in uppercase.

Converted to Question XML

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

 <question type="shortanswer">
   <name>
     <text>Gorilla question</text>
   </name>
   <questiontext>
     <text>Gorilla</text>
   </questiontext>
   <answer fraction="100">
     <text>Gorillas are the largest of the primates.</text>
   </answer>

</question> </quiz>

Note

The tag names have to be in lowercase.

XML mapping

As I understand the basic mapping is as follows:

Glossary

<ENTRY>

   <CONCEPT>Gorilla</CONCEPT>
   <DEFINITION>Gorillas are the largest of the primates.</DEFINITION>

</ENTRY>

Quiz question

<question type="shortanswer">

   <questiontext>Gorilla</questiontext>
   <answer>Gorillas are the largest of the primates.</answer>

</question>

Note

This code is simplified and won't work in praxis.