def build(self, builder):
        """Build XML by appending to builder"""

        params = dict(
            OID=self.oid,
            Name=self.name,
            DataType=self.datatype.value,
            Length=str(self.length),
        )

        if self.date_time_format is not None:
            params["mdsol:DateTimeFormat"] = self.date_time_format

        params["mdsol:Active"] = bool_to_yes_no(self.active)

        if self.significant_digits is not None:
            params["SignificantDigits"] = str(self.significant_digits)

        if self.sas_field_name is not None:
            params["SASFieldName"] = self.sas_field_name

        if self.sds_var_name is not None:
            params["SDSVarName"] = self.sds_var_name

        if self.origin is not None:
            params["Origin"] = self.origin

        if self.comment is not None:
            params["Comment"] = self.comment

        if self.control_type is not None:
            params["mdsol:ControlType"] = self.control_type.value

        if self.acceptable_file_extensions is not None:
            params["mdsol:AcceptableFileExtensions"] = self.acceptable_file_extensions

        if self.default_value is not None:
            params["mdsol:DefaultValue"] = str(self.default_value)

        params["mdsol:SourceDocument"] = bool_to_yes_no(self.source_document_verify)
        params["mdsol:IndentLevel"] = str(self.indent_level)

        if self.sas_format is not None:
            params["mdsol:SASFormat"] = self.sas_format

        if self.sas_label is not None:
            params["mdsol:SASLabel"] = self.sas_label

        params["mdsol:QueryFutureDate"] = bool_to_yes_no(self.query_future_date)
        params["mdsol:Visible"] = bool_to_yes_no(self.visible)
        params["mdsol:TranslationRequired"] = bool_to_yes_no(self.translation_required)
        params["mdsol:QueryNonConformance"] = bool_to_yes_no(self.query_non_conformance)
        params["mdsol:OtherVisits"] = bool_to_yes_no(self.other_visits)
        params["mdsol:CanSetItemGroupDate"] = bool_to_yes_no(
            self.can_set_item_group_date
        )
        params["mdsol:CanSetFormDate"] = bool_to_yes_no(self.can_set_form_date)
        params["mdsol:CanSetStudyEventDate"] = bool_to_yes_no(
            self.can_set_study_event_date
        )
        params["mdsol:CanSetSubjectDate"] = bool_to_yes_no(self.can_set_subject_date)
        params["mdsol:VisualVerify"] = bool_to_yes_no(self.visual_verify)
        params["mdsol:DoesNotBreakSignature"] = bool_to_yes_no(
            self.does_not_break_signature
        )

        if self.field_number is not None:
            params["mdsol:FieldNumber"] = self.field_number

        if self.variable_oid is not None:
            params["mdsol:VariableOID"] = self.variable_oid

        builder.start("ItemDef", params)

        if self.question is not None:
            self.question.build(builder)

        if self.codelistref is not None:
            self.codelistref.build(builder)

        for mur in self.measurement_unit_refs:
            mur.build(builder)

        for range_check in self.range_checks:
            range_check.build(builder)

        if self.header_text is not None:
            self.header_text.build(builder)

        for view_restriction in self.view_restrictions:
            view_restriction.build(builder)

        for entry_restriction in self.entry_restrictions:
            entry_restriction.build(builder)

        for help_text in self.help_texts:
            help_text.build(builder)

        for review_group in self.review_groups:
            review_group.build(builder)

        for alias in self.aliases:
            alias.build(builder)

        builder.end("ItemDef")
def build ( self , builder ) : params = dict ( OID = self . oid , Name = self . name , DataType = self . datatype . value , Length = str ( self . length ) , ) if self . date_time_format is not None : params [ "mdsol:DateTimeFormat" ] = self . date_time_format params [ "mdsol:Active" ] = bool_to_yes_no ( self . active ) if self . significant_digits is not None : params [ "SignificantDigits" ] = str ( self . significant_digits ) if self . sas_field_name is not None : params [ "SASFieldName" ] = self . sas_field_name if self . sds_var_name is not None : params [ "SDSVarName" ] = self . sds_var_name if self . origin is not None : params [ "Origin" ] = self . origin if self . comment is not None : params [ "Comment" ] = self . comment if self . control_type is not None : params [ "mdsol:ControlType" ] = self . control_type . value if self . acceptable_file_extensions is not None : params [ "mdsol:AcceptableFileExtensions" ] = self . acceptable_file_extensions if self . default_value is not None : params [ "mdsol:DefaultValue" ] = str ( self . default_value ) params [ "mdsol:SourceDocument" ] = bool_to_yes_no ( self . source_document_verify ) params [ "mdsol:IndentLevel" ] = str ( self . indent_level ) if self . sas_format is not None : params [ "mdsol:SASFormat" ] = self . sas_format if self . sas_label is not None : params [ "mdsol:SASLabel" ] = self . sas_label params [ "mdsol:QueryFutureDate" ] = bool_to_yes_no ( self . query_future_date ) params [ "mdsol:Visible" ] = bool_to_yes_no ( self . visible ) params [ "mdsol:TranslationRequired" ] = bool_to_yes_no ( self . translation_required ) params [ "mdsol:QueryNonConformance" ] = bool_to_yes_no ( self . query_non_conformance ) params [ "mdsol:OtherVisits" ] = bool_to_yes_no ( self . other_visits ) params [ "mdsol:CanSetItemGroupDate" ] = bool_to_yes_no ( self . can_set_item_group_date ) params [ "mdsol:CanSetFormDate" ] = bool_to_yes_no ( self . can_set_form_date ) params [ "mdsol:CanSetStudyEventDate" ] = bool_to_yes_no ( self . can_set_study_event_date ) params [ "mdsol:CanSetSubjectDate" ] = bool_to_yes_no ( self . can_set_subject_date ) params [ "mdsol:VisualVerify" ] = bool_to_yes_no ( self . visual_verify ) params [ "mdsol:DoesNotBreakSignature" ] = bool_to_yes_no ( self . does_not_break_signature ) if self . field_number is not None : params [ "mdsol:FieldNumber" ] = self . field_number if self . variable_oid is not None : params [ "mdsol:VariableOID" ] = self . variable_oid builder . start ( "ItemDef" , params ) if self . question is not None : self . question . build ( builder ) if self . codelistref is not None : self . codelistref . build ( builder ) for mur in self . measurement_unit_refs : mur . build ( builder ) for range_check in self . range_checks : range_check . build ( builder ) if self . header_text is not None : self . header_text . build ( builder ) for view_restriction in self . view_restrictions : view_restriction . build ( builder ) for entry_restriction in self . entry_restrictions : entry_restriction . build ( builder ) for help_text in self . help_texts : help_text . build ( builder ) for review_group in self . review_groups : review_group . build ( builder ) for alias in self . aliases : alias . build ( builder ) builder . end ( "ItemDef" )
Build XML by appending to builder