XSD reverse generation: ComplexType
The "ComplexType" tag defines the structure of an XML tag. This structure can then be reused by other tags. The structure is complex, meaning that it may contain attributes and sub-tags. Other types may also be inherited, while restricting them (certain existing elements and attributes are restricted, such as multiplicity) or adding new attributes and elements.
The "ComplexType" tag is modeled by a UML class.
Attributes of "ComplexType"
• Abstract: modeled by the Abstract attribute of the UML class associated with the type.
• Block: modeled by the parameters:
• XSD Block Extension: "yes" if preventing substitution by a type inherited by extension in the document instance, or "no" otherwise.
• XSD Block Restriction: "yes" if preventing substitution by a type inherited by restriction in the document instance, or "no" otherwise.
• Final: modeled by the parameters:
• XSD Final Extension: "yes" if preventing inheritance by extension of the complexType, or "no" otherwise.
• XSD Final Restriction: "yes" if preventing inheritance by restriction of the complexType, or "no" otherwise.
• Id: modeled by the XSD ID parameter.
• Mixed: modeled by the XDD Text parameter. If the value of the attribute is "yes", the XDD Text parameter is set to "yes". Otherwise, it is "no".
• Name: defines the name of the type. To generate a name different from that of the class, indicate the new name in the XSD Name parameter.
• Type: this is for modeling which type is reverse generated: This attribute is modeled by the XSD Type parameter, which can have the value "simple type" or "complex type". In the present case, its value is "complex type". It is optional.
SimpleContent
The modeling depends on the type of inheritance:
If the type restricts a primitive type, the following is created:
• A generalization between the two types. Then the XSD Inherited By Restriction generalization attribute is initialized to "yes".
• If the restriction has facets, constraints are created as they were for simple types, and the facet values are associated with them.
• If the restriction also restricts attributes of the primitive type, the overloading attribute is created, and the overloading attribute is connected to the overloaded attributed by the "overloaded attribute" leg.
• If the restriction restricts a group of attributes of the primitive type, the overloading group of attributes is created, and the overloading group is connected to the overloaded group by the "overloaded role" leg.
If the type extends a primitive type, the following is created:
• A generalization between the two types. Then the XSD Inherited By Restriction generalization attribute is initialized to "no".
• The new attributes and new groups are created.
ComplexContent
The modeling depends on the type of inheritance:
If the type restricts a primitive type, the following is created:
• A generalization between the two types. Then the XSD Inherited By Restriction generalization attribute is initialized to "yes".
• If the restriction restricts elements of the primitive type, the overloading element is created, and the overloading element is connected to the overloaded element by the "overloaded role" leg.
• If the restriction restricts attributes of the primitive type, the overloading attribute is created, and the overloading attribute is connected to the overloaded attribute by the "overloaded attribute" leg.
• If the restriction restricts a group of attributes or elements of the primitive type, the overloading group is created, and the overloading group is connected to the overloaded group by the "overloaded role" leg.
If the type extends a primitive type, the following is created:
• A generalization between the two types. Then the XSD Inherited By Restriction generalization attribute is initialized to "no".
• The new attributes, new elements, and new groups are created.