--- a/OSSEval/analysis/models.py
+++ b/OSSEval/analysis/models.py
@@ -13,6 +13,23 @@
     protected = models.BooleanField(default=False)
     def __unicode__(self):
         return self.name
+    def from_xml(self, xmldoc, insert = True):
+        #All but the MethodologyVersion so that we can independently import from xml MethodologyVersion and Analysis
+        pass
+    def to_xml(self):
+        str_xml = "<Id>" + str(self.id) + "</Id>"
+        str_xml += "<Name>" + self.name + "</Name>"
+        str_xml += "<Description>" + self.description + "</Description>"
+        str_xml += "<Comment>" + self.comment + "</Comment>"
+        str_xml += "<Created>" + str(self.created) + "</Created>"
+        str_xml += "<UserLogin>" + self.user_login + "</UserLogin>"
+        str_xml += self.weight_scenario.to_xml()
+        str_xml += "<Instances>"
+        for instance in self.instance_set.all():
+            str_xml += instance.to_xml()
+        str_xml += "</Instances>"
+             
+        return "<Analysis>" + str_xml + "</Analysis>"
     
 class Instance(models.Model):
     """
@@ -23,6 +40,18 @@
     analysis = models.ForeignKey(Analysis)
     def __unicode__(self):
         return self.name + " - " + self.name_for_search
+    def from_xml(self, xmldoc, insert = True):
+        pass
+    def to_xml(self):
+        str_xml = "<Id>" + str(self.id) + "</Id>"
+        str_xml += "<Name>" + self.name + "</Name>"
+        str_xml += "<NameForSearch>" + self.name_for_search + "</NameForSearch>"
+        str_xml += "<Answers>"
+        for answer in self.answer_set.all():
+            str_xml += answer.to_xml()
+        str_xml += "</Answers>"
+             
+        return "<Instance>" + str_xml + "</Instance>"
     
 class Answer(models.Model):
     """
@@ -32,4 +61,18 @@
     question = models.ForeignKey('methodology.Question')
     value_integer = models.IntegerField()
     notes = models.CharField(max_length=2000)
+    def from_xml(self, xmldoc, insert = True):
+        pass
+    def to_xml(self):
+        str_xml = "<Id>" + str(self.id) + "</Id>"
+        str_xml += "<ValueInteger>" + self.value_integer + "</ValueInteger>"
+        str_xml += "<Notes>" + self.notes + "</Notes>"
+        str_xml += "<Question><Id>" + str(self.question.id) + "</Id></Question>"
+             
+        return "<Answer>" + str_xml + "</Answer>"
 
+class UploadedFile(models.Model):
+    '''
+    Used to save uploaded xml file so that it can be later retrieved and imported
+    '''
+    docfile = models.FileField(upload_to='documents/%Y/%m/%d')