Note: You are currently viewing documentation for Moodle 3.7. Up-to-date documentation for the latest stable version of Moodle may be available here: Importing/exporting glossaries.

Importing/exporting glossaries: Difference between revisions

From MoodleDocs
No edit summary
(content moved from Viewing a glossary)
Line 1: Line 1:
{{Glossaries}}
{{Glossaries}}


===Importing a glossary===
==Import entries==


There are two ways to import glossaries
This allows you to import glossaries that have been exported from other glossaries. To import entries, select the XML file on your own computer which contains the entries to import (using the Browse button).


1. Restoring the glossaries from a moodle course backup file containing the glossary. This method includes categories, images and attachments within glossary entries and if you also select users then the authors of entries are also imported if they were originally included in the backup.
The Destination field allows you to define the destination of imported entries. You can specify whether you want to import entries to ''Current Glossary'' (which will append the imported entries to the currently open glossary) or ''New Glossary'' (which will create a new glossary based on the information found in the selected import file and will insert the new entries into it).  


2. Importing a specially formatted XML file in glossary format. This method only imports text, some HTML formatting and switches such as auto-linking, case specific and whole words linking. There is also a switch to import categories into which entries are automatically included.
If you check the Import categories box, you will import not only the entries but also the categories the new entries will be assigned to.
https://docs.moodle.org/en/index.php?title=Importing/exporting_glossaries&action=edit
Editing Importing/exporting glossaries - Edit - MoodleDocs
====Some import issues====


You can only import the XML file from within a glossary that already exists but you can import to a new glossary.
Import format example:


In experimenting with import I have found that the import will fail often. Some reasons appear to be:-
<pre><?xml version="1.0" encoding="utf-8"?>
<GLOSSARY>
    <INFO>
        <NAME>Latest Glossary</NAME>
        <INTRO>Glossary of topics relevant to all Students and Staff</INTRO>
        <STUDENTCANPOST>0</STUDENTCANPOST>
        <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>20</ENTBYPAGE>
        <ENTRIES>
                <ENTRY>             
                <CONCEPT>Bullying</CONCEPT>
                <DEFINITION>Bullying is bad</DEFINITION>
                <FORMAT>1</FORMAT>
                <USEDYNALINK>0</USEDYNALINK>
                <CASESENSITIVE>0</CASESENSITIVE>
                <FULLMATCH>0</FULLMATCH>
                <TEACHERENTRY>1</TEACHERENTRY>
                <ALIASES>
                    <ALIAS>
                        <NAME>harrassment</NAME>
                    </ALIAS>
                </ALIASES>
                <CATEGORIES>
                    <CATEGORY>
                        <NAME>Behaviour</NAME>
                        <USEDYNALINK>1</USEDYNALINK>
                    </CATEGORY>
                </CATEGORIES>
            </ENTRY>
            <ENTRY>
                <CONCEPT>Friendship</CONCEPT>
                <DEFINITION>Friendship is good</DEFINITION>
                <FORMAT>1</FORMAT>
                <USEDYNALINK>0</USEDYNALINK>
                <CASESENSITIVE>0</CASESENSITIVE>
                <FULLMATCH>0</FULLMATCH>
                <TEACHERENTRY>1</TEACHERENTRY>
                <ALIASES>
                    <ALIAS>
                        <NAME>friend</NAME>
                    </ALIAS>
                </ALIASES>
                <CATEGORIES>
                    <CATEGORY>
                        <NAME>Social</NAME>
                        <USEDYNALINK>1</USEDYNALINK>
                    </CATEGORY>
                </CATEGORIES>
            </ENTRY>
        </ENTRIES>
    </INFO>
</GLOSSARY></pre>


If there are mistakes in the XML file such as the <entries> tag being missing or the <info> tag being in the wrong place. May happen if you have constructed the XML file manually or with some sort of tool like mailmerge in Word and your template is wrong.
Copy each section beginning <ENTRY> and ending with </ENTRY> and edit the entry.


If there are top bit set characters in the text of the entities like concepts, definitions or keywords. Replace things like & with &amp;amp;
Notes:


If there are tabs or spaces between entries. Not sure if spaces cause problems but best to remove any between the end of one tag and start of the next. e.g. Search and replace > < with >< via a text editor.
*You can only import the XML file from within a glossary that already exists but you can import to a new glossary.
*In experimenting with import I have found that the import will fail often. Some reasons appear to be:-
**If there are mistakes in the XML file such as the <entries> tag being missing or the <info> tag being in the wrong place. May happen if you have constructed the XML file manually or with some sort of tool like mailmerge in Word and your template is wrong.
**If there are top bit set characters in the text of the entities like concepts, definitions or keywords. Replace things like & with &amp;amp;
**If there are tabs or spaces between entries. Not sure if spaces cause problems but best to remove any between the end of one tag and start of the next. e.g. Search and replace > < with >< via a text editor.
*In most cases the import is halted if any of these errors occur.
*Duplicates in the entries which clash with entries already when merging a glossary is usually not a problem.
*Warnings like <code>Warning: exec() has been disabled for security reasons in /moodle/lib/uploadlib.php on line 603</code> may not be the problem when importing but may distract one from dealing with problems with the format of the XML file.


In most cases the import is halted if any of these errors occur.
==Export entries==


Duplicates in the entries which clash with entries already when merging a glossary is usually not a problem.
This allows you to export your glossary to share with another glossary. Clicking Export entries will generate an xml file, which, as it says, you can import in this or other course.


Warnings like
==Import/export of glossaries==


Warning: exec() has been disabled for security reasons in /moodle/lib/uploadlib.php on line 603
There are two ways to import glossaries:
may not be the problem when importing but may distract one from dealing with problems with the format of the XML file.


===Exporting a glossary===
#Restoring the glossaries from a Moodle course backup file containing the glossary. This method includes categories, images and attachments within glossary entries and if you also select users then the authors of entries are also imported if they were originally included in the backup.
#Importing a specially formatted XML file in glossary format. This method only imports text, some HTML formatting and switches such as auto-linking, case specific and whole words linking. There is also a switch to import categories into which entries are automatically included.


There are two ways to export glossaries
There are two ways to export glossaries:
 
#Backing up glossaries only via a Moodle course backup file. This method will also export any categories, embedded images and attached files within entries and any HTML formatting. If users are also exported authors of entries are also included.
1. Backing up glossaries only via a moodle course backup file. This method will also export any categories, embedded images and attached files within entries and any HTML formatting. If users are also exported authors of entries are also included.
#Exporting a specially formatted XML file in glossary format. This will only export text, some HTML formatting and switches such as auto-linking, case specific and whole words linking.
 
2. Exporting a specially formatted XML file in glossary format. This will only export text, some HTML formatting and switches such as auto-linking, case specific and whole words linking.
 
====Some export Issues====
 
You can only export the XML file from within a glossary.
 
===Glossaries in the future===
 
The glossary module may eventually be replaced by the database module which will greatly improve import and export functionality.
 
== See also ==
 
*[http://download.moodle.org/docs/using_moodle/ch9_glossaries.pdf Using Moodle Chapter 9: Glossaries]
*Using Moodle [http://moodle.org/mod/forum/discuss.php?d=54403 Any creative ideas/ stories for using glossaries] forum discussion
 
[[Category:Teacher]]
[[Category:Glossary]]
[[Category:Modules]]


[[fr:Importer/exporter un glossaire]]
[[fr:Importer/exporter un glossaire]]

Revision as of 15:36, 4 August 2007

Template:Glossaries

Import entries

This allows you to import glossaries that have been exported from other glossaries. To import entries, select the XML file on your own computer which contains the entries to import (using the Browse button).

The Destination field allows you to define the destination of imported entries. You can specify whether you want to import entries to Current Glossary (which will append the imported entries to the currently open glossary) or New Glossary (which will create a new glossary based on the information found in the selected import file and will insert the new entries into it).

If you check the Import categories box, you will import not only the entries but also the categories the new entries will be assigned to.

Import format example:

<?xml version="1.0" encoding="utf-8"?>
<GLOSSARY>
    <INFO>
        <NAME>Latest Glossary</NAME>
        <INTRO>Glossary of topics relevant to all Students and Staff</INTRO>
        <STUDENTCANPOST>0</STUDENTCANPOST>
        <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>20</ENTBYPAGE>
        <ENTRIES>
                <ENTRY>               
                <CONCEPT>Bullying</CONCEPT>
                <DEFINITION>Bullying is bad</DEFINITION>
                <FORMAT>1</FORMAT>
                <USEDYNALINK>0</USEDYNALINK>
                <CASESENSITIVE>0</CASESENSITIVE>
                <FULLMATCH>0</FULLMATCH>
                <TEACHERENTRY>1</TEACHERENTRY>
                <ALIASES>
                    <ALIAS>
                        <NAME>harrassment</NAME>
                    </ALIAS>
                </ALIASES>
                <CATEGORIES>
                    <CATEGORY>
                        <NAME>Behaviour</NAME>
                        <USEDYNALINK>1</USEDYNALINK>
                    </CATEGORY>
                </CATEGORIES>
            </ENTRY>
            <ENTRY>
                <CONCEPT>Friendship</CONCEPT>
                <DEFINITION>Friendship is good</DEFINITION>
                <FORMAT>1</FORMAT>
                <USEDYNALINK>0</USEDYNALINK>
                <CASESENSITIVE>0</CASESENSITIVE>
                <FULLMATCH>0</FULLMATCH>
                <TEACHERENTRY>1</TEACHERENTRY>
                <ALIASES>
                    <ALIAS>
                        <NAME>friend</NAME>
                    </ALIAS>
                </ALIASES>
                <CATEGORIES>
                    <CATEGORY>
                        <NAME>Social</NAME>
                        <USEDYNALINK>1</USEDYNALINK>
                    </CATEGORY>
                </CATEGORIES>
            </ENTRY>
        </ENTRIES>
    </INFO>
</GLOSSARY>

Copy each section beginning <ENTRY> and ending with </ENTRY> and edit the entry.

Notes:

  • You can only import the XML file from within a glossary that already exists but you can import to a new glossary.
  • In experimenting with import I have found that the import will fail often. Some reasons appear to be:-
    • If there are mistakes in the XML file such as the <entries> tag being missing or the <info> tag being in the wrong place. May happen if you have constructed the XML file manually or with some sort of tool like mailmerge in Word and your template is wrong.
    • If there are top bit set characters in the text of the entities like concepts, definitions or keywords. Replace things like & with &amp;
    • If there are tabs or spaces between entries. Not sure if spaces cause problems but best to remove any between the end of one tag and start of the next. e.g. Search and replace > < with >< via a text editor.
  • In most cases the import is halted if any of these errors occur.
  • Duplicates in the entries which clash with entries already when merging a glossary is usually not a problem.
  • Warnings like Warning: exec() has been disabled for security reasons in /moodle/lib/uploadlib.php on line 603 may not be the problem when importing but may distract one from dealing with problems with the format of the XML file.

Export entries

This allows you to export your glossary to share with another glossary. Clicking Export entries will generate an xml file, which, as it says, you can import in this or other course.

Import/export of glossaries

There are two ways to import glossaries:

  1. Restoring the glossaries from a Moodle course backup file containing the glossary. This method includes categories, images and attachments within glossary entries and if you also select users then the authors of entries are also imported if they were originally included in the backup.
  2. Importing a specially formatted XML file in glossary format. This method only imports text, some HTML formatting and switches such as auto-linking, case specific and whole words linking. There is also a switch to import categories into which entries are automatically included.

There are two ways to export glossaries:

  1. Backing up glossaries only via a Moodle course backup file. This method will also export any categories, embedded images and attached files within entries and any HTML formatting. If users are also exported authors of entries are also included.
  2. Exporting a specially formatted XML file in glossary format. This will only export text, some HTML formatting and switches such as auto-linking, case specific and whole words linking.