Exports this object into a LEMS XML object

def toxml(self):
        """
        Exports this object into a LEMS XML object
        """

        xmlstr = '<Component id="{0}" type="{1}"'.format(self.id, self.type)

        for (k, v) in self.parameters.items():
            xmlstr += ' {0}="{1}"'.format(k, v)

        if self.children:
            xmlstr += '>'
            for child in self.children:
                xmlstr += child.toxml()
            xmlstr += '</Component>'
        else:
            xmlstr += '/>'

        return xmlstr