class xmodels.models.Model[source]

The Model is the main component of xmodels.models. It is the base class for AttributeModel and SequenceModel implementing common logic.

Usually one defines a number of fields as class variables. Fields may have default values. All fields can be assigned and read. A read to a field which has not been set previously return the default value if one exists or None. The validate method validates all fields defined as class variables.

Instance variables may be created in addition to the fields specified as class variables if Meta.allow_extra_elements is True. Otherwise the model validation fails. The validation results are stored in a logger instance.

class xmodels.models.SequenceModel[source]

The SequenceModel is used to describe xml elements using xsd:sequence. The sequence is described with a list of SequenceElement in Meta.sequence. The validation method checks if all required attributes and min_occurs > 0 elements are not None.

The initial class variable is used for context initialization for identity constraints checking.