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

        xmlstr = '<ConditionalDerivedVariable name="{0}"'.format(self.name) +\
          (' dimension="{0}"'.format(self.dimension) if self.dimension else '') +\
          (' exposure="{0}"'.format(self.exposure) if self.exposure else '') 
          
        chxmlstr = ''

        for case in self.cases:
            chxmlstr += case.toxml()

        if chxmlstr:
            xmlstr += '>' + chxmlstr + '</ConditionalDerivedVariable>'
        else:
            xmlstr += '/>'
            
        return xmlstr