def build(self, builder):
        """Build XML by appending to builder"""
        params = dict(Value=self.value,
                      Status=self.status.value,
                      ProtocolDeviationRepeatKey=self.repeat_key
                      )

        if self.code:
            params['Code'] = self.code
        if self.pdclass:
            params['Class'] = self.pdclass
        if self.transaction_type:
            params['TransactionType'] = self.transaction_type
        builder.start('mdsol:ProtocolDeviation', params)
        builder.end('mdsol:ProtocolDeviation')