diff -Nuar standard_moodle/backup/moodle2/backup_qtype_plugin.class.php my_moodle/backup/moodle2/backup_qtype_plugin.class.php
--- standard_moodle/backup/moodle2/backup_qtype_plugin.class.php	2011-03-12 00:15:44.000000000 +0300
+++ my_moodle/backup/moodle2/backup_qtype_plugin.class.php	2011-03-12 00:14:37.000000000 +0300
@@ -28,6 +28,9 @@
  *
  * TODO: Finish phpdocs
  */
+require_once ('../config.php');
+require_once ($CFG->dirroot . '/lib/questionlib.php');
+
 abstract class backup_qtype_plugin extends backup_plugin {
 
     /**
@@ -203,4 +206,43 @@
         // By default, return empty array, only qtypes having own fileareas will override this
         return array();
     }
+
+    /**
+     * Returns the qtype information to attach to question element
+     * based on extra_question_fields and extra_answer_fields
+     * you need to reimplement this if 
+     */
+    protected function define_question_plugin_structure() {
+        global $QTYPES;
+        $pluginname = $this->pluginname;
+        $questiontype = $QTYPES[$pluginname];
+        $questionidfield = $questiontype->questionid_column_name();
+        // Define the virtual plugin element with the condition to fulfill
+        $plugin = $this->get_plugin_element(null, '../../qtype', $pluginname);
+
+        // Create one standard named plugin element (the visible container)
+        $pluginwrapper = new backup_nested_element($this->get_recommended_name());
+
+        // connect the visible container ASAP
+        $plugin->add_child($pluginwrapper);
+        // If this qtype uses standard question_answers, add them here
+        // to the tree before any other information that will use them
+        if ($questiontype->use_answers()) {
+            $this->add_question_question_answers($pluginwrapper);
+        }
+
+        $extraquestionfields = $questiontype->extra_question_fields();
+        if (is_array($extraquestionfields)) {
+            $questionextensiontable = array_shift($extraquestionfields);
+            $question = new backup_nested_element($pluginname, array('id'), $extraquestionfields);
+            $pluginwrapper->add_child($question);
+            $question->set_source_table($questionextensiontable, array($questionidfield => backup::VAR_PARENTID));
+        }
+
+        $extraanswerfields = $questiontype->extra_answer_fields();
+        if (is_array($extraanswerfields)) {
+            // TODO backup extra answer table
+        }
+        return $plugin;
+    }
 }
diff -Nuar standard_moodle/backup/moodle2/restore_qtype_plugin.class.php my_moodle/backup/moodle2/restore_qtype_plugin.class.php
--- standard_moodle/backup/moodle2/restore_qtype_plugin.class.php	2011-03-12 00:15:44.000000000 +0300
+++ my_moodle/backup/moodle2/restore_qtype_plugin.class.php	2011-03-12 00:14:38.000000000 +0300
@@ -22,6 +22,9 @@
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
 
+require_once ('../config.php');
+require_once ($CFG->dirroot . '/lib/questionlib.php');
+
 /**
  * Class extending standard restore_plugin in order to implement some
  * helper methods related with the questions (qtype plugin)
@@ -306,6 +309,75 @@
     }
 
     /**
+     * Returns the paths to be handled by the plugin at question level
+     */
+    protected function define_question_plugin_structure() {
+        global $QTYPES;
+        $pluginname = $this->pluginname;
+        $questiontype = $QTYPES[$pluginname];
+        $paths = array();
+
+        // If this qtype uses question_answers, add them
+        if ($questiontype->use_answers()) {
+            $this->add_question_question_answers($paths);
+        }
+
+        // Add own qtype stuff
+        $extraquestionfields = $questiontype->extra_question_fields();
+        if (is_array($extraquestionfields)) {
+            $elename = $pluginname;
+            $elepath = $this->get_pathfor("/{$pluginname}"); // we used get_recommended_name() so this works
+            $paths[] = new restore_path_element($elename, $elepath);
+        }
+
+        $extraanswerfields = $questiontype->extra_answer_fields();
+        if (is_array($extraanswerfields)) {
+            //TODO restore extra answer table
+        }
+
+        return $paths; // And we return the interesting paths
+    }
+
+    /**
+     *
+     */
+    public function process_extra_question_fields($data){
+        global $DB;
+        global $QTYPES;
+        $pluginname = $this->pluginname;
+        $qtypeobj = $QTYPES[$pluginname];
+        $extraquestionffields = $qtypeobj->extra_question_fields();
+        $extraquestiontable = array_shift($extraquestionffields);
+        $questionfield = $qtypeobj->questionid_column_name();
+        $data = (object)$data;
+        $oldid = $data->id;
+
+        // Detect if the question is created or mapped
+        $oldquestionid   = $this->get_old_parentid('question');
+        $newquestionid   = $this->get_new_parentid('question');
+        $questioncreated = $this->get_mappingid('question_created', $oldquestionid) ? true : false;
+
+        if ($questioncreated) {
+            // Adjust some columns
+            $data->$questionfield = $newquestionid;
+            $this->remap_extra_question_fields($data);
+            // Insert record
+            $newitemid = $DB->insert_record($extraquestiontable, $data);
+            // Create mapping
+            $this->set_mapping($extraquestiontable, $oldid, $newitemid);
+        } else {
+            // Nothing to remap if the question already existed
+        }
+    }
+
+    /**
+     * remap ids in extra question table. reimplement this in your class
+     */
+    protected function remap_extra_question_fields(&$data) {
+        return null;
+    }
+
+    /**
      * Return the contents of the questions stuff that must be processed by the links decoder
      *
      * Only common stuff to all plugins, in this case:
diff -Nuar standard_moodle/question/type/edit_question_form.php my_moodle/question/type/edit_question_form.php
--- standard_moodle/question/type/edit_question_form.php	2011-03-12 00:15:44.000000000 +0300
+++ my_moodle/question/type/edit_question_form.php	2011-03-12 00:14:38.000000000 +0300
@@ -352,12 +352,34 @@
         }
 
         // Set any options.
-        $extra_question_fields = $QTYPES[$question->qtype]->extra_question_fields();
-        if (is_array($extra_question_fields) && !empty($question->options)) {
-            array_shift($extra_question_fields);
-            foreach ($extra_question_fields as $field) {
+        $extraquestionfields = $QTYPES[$question->qtype]->extra_question_fields();
+        if (is_array($extraquestionfields) && !empty($question->options)) {
+            array_shift($extraquestionfields);
+            $transformedfields = $QTYPES[$question->qtype]->transform_extra_fields($extraquestionfields);
+            foreach ($transformedfields as $field => $type) {
                 if (isset($question->options->$field)) {
-                    $question->$field = $question->options->$field;
+                    if ($type == 'simple') {
+                        $question->$field = $question->options->$field;
+                    } elseif ($type == 'formated_text') {
+                        $fieldformat = $field . 'format';
+                        // processing files
+                        $component = 'qtype_' . $question->qtype;
+                        $draftid = file_get_submitted_draft_itemid($field);
+                        $question->{$field} = array();
+                        if (isset($question->options->$fieldformat)) {
+                            $question->{$field}['format'] = $question->options->$fieldformat;
+                            $question->{$field}['text'] = file_prepare_draft_area(
+                                $draftid,       // draftid
+                                $context->id,   // context
+                                $component,     // component
+                                $field,         // filarea
+                                !empty($question->id)?(int)$question->id:null, // itemid
+                                $mform->fileoptions,    // options
+                                $question->options->$field // text
+                            );
+                        }
+                        $question->{$field}['itemid'] = $draftid;
+                    }
                 }
             }
         }
diff -Nuar standard_moodle/question/type/questiontype.php my_moodle/question/type/questiontype.php
--- standard_moodle/question/type/questiontype.php	2011-03-12 00:15:44.000000000 +0300
+++ my_moodle/question/type/questiontype.php	2011-03-12 00:16:03.000000000 +0300
@@ -411,30 +411,37 @@
     */
     function save_question_options($question) {
         global $DB;
-        $extra_question_fields = $this->extra_question_fields();
-
-        if (is_array($extra_question_fields)) {
-            $question_extension_table = array_shift($extra_question_fields);
+        $result = new stdClass;
+        $result->notice = $this->prepare_question($question);
+        $extraquestionfields = $this->extra_question_fields();
 
+        if (is_array($extraquestionfields)) {
+            $questionextensiontable = array_shift($extraquestionfields);
+            $transformedfields = $this->transform_extra_fields($extraquestionfields);
             $function = 'update_record';
             $questionidcolname = $this->questionid_column_name();
-            $options = $DB->get_record($question_extension_table, array($questionidcolname => $question->id));
+            $options = $DB->get_record($questionextensiontable, array($questionidcolname => $question->id));
             if (!$options) {
                 $function = 'insert_record';
                 $options = new stdClass;
                 $options->$questionidcolname = $question->id;
             }
-            foreach ($extra_question_fields as $field) {
+            foreach ($transformedfields as $field => $type) {
                 if (!isset($question->$field)) {
-                    $result = new stdClass;
                     $result->error = "No data for field $field when saving " .
                             $this->name() . ' question id ' . $question->id;
                     return $result;
                 }
-                $options->$field = $question->$field;
+                if ($type == 'simple') {
+                    $options->$field = $question->$field;
+                } elseif ($type == 'formated_text') {
+                    $options->$field = $this->import_or_save_files($question->$field,
+                                $question->context, 'qtype_'.$question->qtype , $field, $question->id);
+                    $options->{$field . 'format'} = $question->{$field}['format'];
+                }
             }
 
-            if (!$DB->{$function}($question_extension_table, $options)) {
+            if (!$DB->{$function}($questionextensiontable, $options)) {
                 $result = new stdClass;
                 $result->error = 'Could not save question options for ' .
                         $this->name() . ' question id ' . $question->id;
@@ -1547,34 +1554,52 @@
         if ($question_type != $this->name()) {
             return false;
         }
-
-        $extraquestionfields = $this->extra_question_fields();
-        if (!is_array($extraquestionfields)) {
-            return false;
-        }
-
-        //omit table name
-        array_shift($extraquestionfields);
         $qo = $format->import_headers($data);
         $qo->qtype = $question_type;
-
-        foreach ($extraquestionfields as $field) {
-            $qo->$field = $format->getpath($data, array('#',$field,0,'#'), $qo->$field);
+        $extraquestionfields = $this->extra_question_fields();
+        if (is_array($extraquestionfields)) {
+            //omit table name
+            array_shift($extraquestionfields);
+            $transformedfield = $this->transform_extra_fields($extraquestionfields);
+            foreach ($transformedfield as $field => $type) {
+                if ($type == 'simple') {
+                    $qo->$field = $format->getpath($data, array('#',$field, 0, '#'), $qo->$field);
+                } elseif ($type == 'formated_text') {
+                    $fielddata = $format->getpath($data, array('#', $field), array());
+                    if (!empty($fielddata)) {
+                        $fieldvalue = array();
+                        $fieldvalue['text'] = $format->getpath($fielddata, array('0', '#', 'text', '0', '#'), '', true);
+                        $fieldvalue['format'] = $format->trans_format(
+                                $format->getpath($fielddata, array('0', '@', 'format'), 'moodle_auto_format'));
+                        $files = $format->getpath($fielddata, array('0', '#', 'file'), array());
+                        $fieldvalue['files'] = array();
+                        foreach ($files as $file) {
+                            $filedata = new stdclass;
+                            $filedata->content = $file['#'];
+                            $filedata->encoding = $file['@']['encoding'];
+                            $filedata->name = $file['@']['name'];
+                            $fieldvalue['files'][]= $filedata;
+                        }
+                        $qo->$field = $fieldvalue;
+                    }
+                }
+            }
         }
-
-        // run through the answers
-        $answers = $data['#']['answer'];
-        $a_count = 0;
-        $extraasnwersfields = $this->extra_answer_fields();
-        if (is_array($extraasnwersfields)) {
-            //TODO import the answers, with any extra data.
-        } else {
+        if ($this->use_answers()) {
+            // run through the answers
+            $answers = $data['#']['answer'];
+            $qo->answer = array();
+            $qo->fraction = array();
+            $qo->feedback = array();
             foreach ($answers as $answer) {
                 $ans = $format->import_answer($answer);
-                $qo->answer[$a_count] = $ans->answer;
-                $qo->fraction[$a_count] = $ans->fraction;
-                $qo->feedback[$a_count] = $ans->feedback;
-                ++$a_count;
+                $qo->answer[] = $ans->answer['text'];
+                $qo->fraction[] = $ans->fraction;
+                $qo->feedback[] = $ans->feedback;
+            }
+            $extraasnwersfields = $this->extra_answer_fields();
+            if (is_array($extraasnwersfields)) {
+                //TODO import the answers, with any extra data.
             }
         }
         return $qo;
@@ -1587,33 +1612,41 @@
      * If some of you fields contains id's you'll need to reimplement this
      */
     function export_to_xml($question, $format, $extra=null) {
-        $extraquestionfields = $this->extra_question_fields();
-        if (!is_array($extraquestionfields)) {
-            return false;
-        }
-
-        //omit table name
-        array_shift($extraquestionfields);
         $expout='';
-        foreach ($extraquestionfields as $field) {
-            $exportedvalue = $question->options->$field;
-            if (!empty($exportedvalue) && htmlspecialchars($exportedvalue) != $exportedvalue) {
-                $exportedvalue = '<![CDATA[' . $exportedvalue . ']]>';
+        $fs = get_file_storage();
+        $extraquestionfields = $this->extra_question_fields();
+        if (is_array($extraquestionfields)) {
+            //omit table name
+            array_shift($extraquestionfields);
+            $transformedfield = $this->transform_extra_fields($extraquestionfields);
+            foreach ($transformedfield as $field => $type) {
+                if ($type == 'simple') {
+                    $expout .= "    <{$field}>{$question->options->$field}</{$field}>\n";
+                } elseif ($type == 'formated_text') {
+                    $fieldformat = $field . 'format';
+                    $textformat = $format->get_format($question->options->$fieldformat);
+                    $files = $fs->get_area_files($question->contextid, 'qtype_' . $question->qtype, $field, $question->id);
+                    $expout .= "    <{$field} format=\"{$textformat}\">\n";
+                    $expout .= $format->writetext($question->options->$field, 3);
+                    $expout .= $format->writefiles($files);
+                    $expout .= "    </{$field}>\n";
+                }
             }
-            $expout .= "    <$field>{$exportedvalue}</$field>\n";
         }
-
-        $extraasnwersfields = $this->extra_answer_fields();
-        if (is_array($extraasnwersfields)) {
-            //TODO export answers with any extra data
-        } else {
+        if ($this->use_answers()) {
+            $extraasnwersfields = $this->extra_answer_fields();
             foreach ($question->options->answers as $answer) {
                 $percent = 100 * $answer->fraction;
                 $expout .= "    <answer fraction=\"$percent\">\n";
                 $expout .= $format->writetext($answer->answer, 3, false);
-                $expout .= "      <feedback>\n";
+                $feedbackformat = $format->get_format($answer->feedbackformat);
+                $expout .= "      <feedback format=\"{$feedbackformat}\">\n";
                 $expout .= $format->writetext($answer->feedback, 4, false);
+                $expout .= $format->writefiles($answer->feedbackfiles);
                 $expout .= "      </feedback>\n";
+                if (is_array($extraasnwersfields)) {
+                    //TODO export answers with any extra data
+                }
                 $expout .= "    </answer>\n";
             }
         }
@@ -1779,4 +1812,43 @@
             return base64_decode($file->content);
         }
     }
+
+    /**
+     * Prepare extra question fields for writing to DB
+     * reimplement in your class if question data must be chaged before writing to DB
+     * @return null if ok, else - notice message
+     */
+    function prepare_question(&$question) {
+        return null;
+    }
+
+    /**
+     * Transform extra options
+     */
+    function transform_extra_fields($fields) {
+        $result = array();
+        $skip = array();
+        foreach ($fields as $field) {
+            if (in_array("{$field}format", $fields)) {
+                $result[$field] = 'formated_text';
+                $skip[] = $field;
+                $skip[] = "{$field}format";
+            }
+        }
+        foreach ($fields as $field) {
+            if (in_array($field, $skip)) {
+                // Skip formated fields and formats
+                continue;
+            }
+            $result[$field] = 'simple';
+        }
+        return $result;
+    }
+
+    /**
+     * Report if this question type uses question_answers table
+     */
+    function use_answers() {
+        return false;
+    }
 }
diff -Nuar standard_moodle/question/type/shortanswer/backup/moodle2/backup_qtype_shortanswer_plugin.class.php my_moodle/question/type/shortanswer/backup/moodle2/backup_qtype_shortanswer_plugin.class.php
--- standard_moodle/question/type/shortanswer/backup/moodle2/backup_qtype_shortanswer_plugin.class.php	2011-03-12 00:15:44.000000000 +0300
+++ my_moodle/question/type/shortanswer/backup/moodle2/backup_qtype_shortanswer_plugin.class.php	2011-03-11 02:17:23.000000000 +0300
@@ -26,38 +26,4 @@
 /**
  * Provides the information to backup shortanswer questions
  */
-class backup_qtype_shortanswer_plugin extends backup_qtype_plugin {
-
-    /**
-     * Returns the qtype information to attach to question element
-     */
-    protected function define_question_plugin_structure() {
-
-        // Define the virtual plugin element with the condition to fulfill
-        $plugin = $this->get_plugin_element(null, '../../qtype', 'shortanswer');
-
-        // Create one standard named plugin element (the visible container)
-        $pluginwrapper = new backup_nested_element($this->get_recommended_name());
-
-        // connect the visible container ASAP
-        $plugin->add_child($pluginwrapper);
-
-        // This qtype uses standard question_answers, add them here
-        // to the tree before any other information that will use them
-        $this->add_question_question_answers($pluginwrapper);
-
-        // Now create the qtype own structures
-        $shortanswer = new backup_nested_element('shortanswer', array('id'), array(
-            'answers', 'usecase'));
-
-        // Now the own qtype tree
-        $pluginwrapper->add_child($shortanswer);
-
-        // set source to populate the data
-        $shortanswer->set_source_table('question_shortanswer', array('question' => backup::VAR_PARENTID));
-
-        // don't need to annotate ids nor files
-
-        return $plugin;
-    }
-}
+class backup_qtype_shortanswer_plugin extends backup_qtype_plugin {}
diff -Nuar standard_moodle/question/type/shortanswer/backup/moodle2/restore_qtype_shortanswer_plugin.class.php my_moodle/question/type/shortanswer/backup/moodle2/restore_qtype_shortanswer_plugin.class.php
--- standard_moodle/question/type/shortanswer/backup/moodle2/restore_qtype_shortanswer_plugin.class.php	2011-03-12 00:15:44.000000000 +0300
+++ my_moodle/question/type/shortanswer/backup/moodle2/restore_qtype_shortanswer_plugin.class.php	2011-03-11 02:17:23.000000000 +0300
@@ -31,54 +31,17 @@
 class restore_qtype_shortanswer_plugin extends restore_qtype_plugin {
 
     /**
-     * Returns the paths to be handled by the plugin at question level
-     */
-    protected function define_question_plugin_structure() {
-
-        $paths = array();
-
-        // This qtype uses question_answers, add them
-        $this->add_question_question_answers($paths);
-
-        // Add own qtype stuff
-        $elename = 'shortanswer';
-        $elepath = $this->get_pathfor('/shortanswer'); // we used get_recommended_name() so this works
-        $paths[] = new restore_path_element($elename, $elepath);
-
-
-        return $paths; // And we return the interesting paths
-    }
-
-    /**
      * Process the qtype/shortanswer element
      */
     public function process_shortanswer($data) {
-        global $DB;
-
-        $data = (object)$data;
-        $oldid = $data->id;
-
-        // Detect if the question is created or mapped
-        $oldquestionid   = $this->get_old_parentid('question');
-        $newquestionid   = $this->get_new_parentid('question');
-        $questioncreated = $this->get_mappingid('question_created', $oldquestionid) ? true : false;
+        $this->process_extra_question_fields($data);
+    }
 
-        // If the question has been created by restore, we need to create its question_shortanswer too
-        if ($questioncreated) {
-            // Adjust some columns
-            $data->question = $newquestionid;
-            // Map sequence of question_answer ids
-            $answersarr = explode(',', $data->answers);
-            foreach ($answersarr as $key => $answer) {
-                $answersarr[$key] = $this->get_mappingid('question_answer', $answer);
-            }
-            $data->answers = implode(',', $answersarr);
-            // Insert record
-            $newitemid = $DB->insert_record('question_shortanswer', $data);
-            // Create mapping
-            $this->set_mapping('question_shortanswer', $oldid, $newitemid);
-        } else {
-            // Nothing to remap if the question already existed
+    protected function remap_extra_question_fields(&$data) {
+        $answersarr = explode(',', $data->answers);
+        foreach ($answersarr as $key => $answer) {
+            $answersarr[$key] = $this->get_mappingid('question_answer', $answer);
         }
+        $data->answers = implode(',', $answersarr);
     }
 }
diff -Nuar standard_moodle/question/type/shortanswer/questiontype.php my_moodle/question/type/shortanswer/questiontype.php
--- standard_moodle/question/type/shortanswer/questiontype.php	2011-03-12 00:15:44.000000000 +0300
+++ my_moodle/question/type/shortanswer/questiontype.php	2011-03-12 00:14:38.000000000 +0300
@@ -409,6 +409,21 @@
         }
     }
 
+    function prepare_question(&$question) {
+        global $DB;
+        $answers = $DB->get_records('question_answers',
+                    array('question' => $question->id), 'id ASC');
+        $answerids = array();
+        foreach($answers as $answer){
+            $answerids[] = $answer->id;
+        }
+        $question->answers = implode(',', $answerids);
+        return null;
+    }
+
+    function use_answers () {
+        return true;
+    }
 }
 //// END OF CLASS ////
 
