def build(self, builder):
        """
        Build XML by appending to builder
        """
        params = {}

        # Add in the transaction type
        if self.transaction_type is not None:
            params["TransactionType"] = self.transaction_type

        if self.seqnum is None:
            # SeqNum is not optional (and defaulted)
            raise ValueError("SeqNum is not set.")  # pragma: no cover
        params["SeqNum"] = str(self.seqnum)

        if self.annotation_id is not None:
            # If an Annotation is contained with an Annotations element,
            # the ID attribute is required.
            params["ID"] = self.annotation_id

        builder.start("Annotation", params)

        if self.flags in (None, []):
            raise ValueError('Flag is not set.')

        # populate the flags
        for flag in self.flags:
            flag.build(builder)

        # add the Comment, if it exists
        if self.comment is not None:
            self.comment.build(builder)

        builder.end("Annotation")
def build ( self , builder ) : params = { } if self . transaction_type is not None : params [ "TransactionType" ] = self . transaction_type if self . seqnum is None : raise ValueError ( "SeqNum is not set." ) params [ "SeqNum" ] = str ( self . seqnum ) if self . annotation_id is not None : params [ "ID" ] = self . annotation_id builder . start ( "Annotation" , params ) if self . flags in ( None , [ ] ) : raise ValueError ( 'Flag is not set.' ) for flag in self . flags : flag . build ( builder ) if self . comment is not None : self . comment . build ( builder ) builder . end ( "Annotation" )
Build XML by appending to builder