Edit Lesson XML - The 'chunks' Element

Submit to FacebookSubmit to Google PlusSubmit to Twitter

Note: The content on these pages that describes the process of creating an XML file will soon be obsolete or, depending on your perspective, perhaps it already is. We've developed a tool that we're calling Lesson Creator which auto-generates the XML file based on your script. This is currently under development but is mostly finished. We use it here at the Language Collaborative and wouldn't dream of writing lesson XML files by hand. If you'd like to be a beta tester for this tool, we invite you to contact us so that we can provide you with a copy.

Overview

This page shows how to edit the chunks element of a lesson XML file.

By the way, this is perhaps the most complex page in our Creating Lessons series. We suggest that you approach it at a time when you are well rested and your mind is fresh. 

Before you begin you should do the steps on the preceding Creating Lessons pages. In particular, you'll need the following:

Once you've done these steps your XML file will look something like this, though obviously your file's contents will be different:



In this example the chunks element contains only one chunk element. We'll edit this file so that there are multiple chunk elements - one for each chunk in your lesson.

For example, the lesson XML for a lesson with 10 chunks would look something like this:

A 10-Chunk Example


You can create these elements by copying the existing chunk element in your file, then pasting it multiple times.

But before you do this you may need to edit the chunk element. In order to know whether any editing is needed and, if so, how to do the editing, you need to understand the logical structure of the lesson XML.


First, Understand the Logic

XML is inherantly logical. Every XML file tells, or at least should tell, a clear and logical story. Let's look at the story that the lesson XML has told us so far.

By now this much is obvious:

Also, as discussed on the Edit Lesson XML - First Steps page, the defaultTextDisplayType element tells us one of two things:

We assume that you've already made this decision, and that your defaultDisplayType element displays the correct value.


The chunk Element's Children

Each of your chunk elements will contain two child elements:

For example, like this:



Or this:



If the file's defaultTextDisplayType element contains "textTargetLanguage", then Language Mentor will expect each chunk element to have a textTargetLanguage element.

If the file's defaultTextDisplayType element contains "textTargetLanguagePhonetic", then Language Mentor will expect each chunk element to have a textTargetLanguagePhonetic element.

From a logical perspective this makes sense. If the app is going to display ordinary text, then we need to provide ordinary text for each chunk, which is what a textTargetLanguage element does. If it's going to display phonetic text then we need to provide phonetic text, which is what a textTargetLanguagePhonetic element does.


Okay, now that you understand the logic...

... here's what you'll do next:

For an example of what the end result will look like, go back and take another look at the ten chunk example above.


Editing the fileNameRoot Element

The simplest way to do this is to simply put two-digit or three-digit numerals, in sequence, into these elements.

For example, like this:

     01, 02, 03, etc.

... or this:

     001, 002, 003, etc.

The ten chunk example above uses this approach.

This is a good approach, and we recommend it, but you have other options. Let's examine what these "file name roots" do and how they work, then discuss your options.


How the fileNameRoot Element is Used

As its name suggests, the fileNameRoot element provides the "root" for file names that are associated with a chunk.

Specifically, Language Mentor looks at a chunk's fileNameRoot element when it want to know how its audio file or files are named.

Audio files are named by combining the file name root, an ISO 639-3 language code, and the ".mp3" file extension.

For example, the English audio file for a chunk with a file name root of "001" would have a file name of "001.eng.mp3". If this chunk also uses a Mandarin Chinese audio file it would be named "001.cmn.mp3".

File name roots perform another function - they determine the order in which a lesson's chunks are played. Language Mentor orders chunks alphabetically by their file name roots.

Note that this may be a different order than the order in which the chunk elements are arranged within the lesson XML file.

For example if a lesson has five chunks, and their file name roots are:

     001, 002, 003, 005, 004

Language Mentor will play the first three chunks in order, then the fifth, then the fourth.

Of course, it makes sense to arrange your chunk elements in the order in which they will be played. But we do this to make the order of the chunks clear to human readers of the file - Language Mentor doesn't pay any attention to this.

As long as you bear this principle in mind, you can give your chunks whatever file name roots you like. For example, you could use file name roots like this:

     a, b, c, d, e ...

Or this:

     001_hello, 002_hi_how_are_you, 003_i'm_great_and_you ...

In this example the numeric prefixes ensure that the chunks play in the correct order, while the words that follow describe the contents of the chunks' English audio. We don't particularly recommend this approach - we're just trying to give you a clear sense of your options.


Editing the textTargetLanguage Element Or textTargetLanguagePhonetic Element

This step is simple. If your lessons will show learners ordinary target language text, put it into your textTargetLanguage elements, as shown in the ten chunk example above. If your lessons will show learners phonetic target language text, put it into the textTargetLanguagePhonetic elements, like this:



Congratulations! Your lesson XML is now functionally complete. There are other elements that you can add, for example elements that specify a lesson's credits, but they are optional and we'll explain them later.


Questions?

If you have questions about the lesson creation process, please contact us on our Creating Lessons forum. We're here to help.


What's Next?

Next we'll explain how to create and edit your lesson's audio files.






.