コード例 #1
0
    def end_complex_type(self, obj: T):
        """Prepend an attribute group reference when default attributes
        apply."""
        if not isinstance(obj, xsd.ComplexType):
            return

        if obj.default_attributes_apply and self.default_attributes:
            attribute_group = xsd.AttributeGroup(ref=self.default_attributes)
            obj.attribute_groups.insert(0, attribute_group)

        if not obj.open_content:
            obj.open_content = self.default_open_content
コード例 #2
0
 def end_restriction(self, obj: T):
     """Set the open content if any to the given restriction."""
     if isinstance(obj, xsd.Restriction) and not obj.open_content:
         obj.open_content = self.default_open_content
コード例 #3
0
 def end_extension(self, obj: T):
     """Set the open content if any to the given extension."""
     if isinstance(obj, xsd.Extension) and not obj.open_content:
         obj.open_content = self.default_open_content