Global Element and ComplexType

 

Topic

Detail

ComplexType element naming convention

Some XML Schemas have ComplexType elements with the same name as the referring global elements, but with the suffix Type as shown below:

 

<xs:element name="Address" type="AddressType"/>

<xs:complexType name="AddressType">

     <xs:sequence/>

</xs:complexType>

 

 

On XSD import, Enterprise Architect treats this global element and its bounding ComplexType as a single entity and creates a single XSDcomplexType stereotyped Class with the same name as the global element as shown below:

 

No_Global_Import

 

Changing the default behavior

You can change the above specified default behaviour by selecting the Import global elements with "Type" postfix checkbox. When you select this option, Enterprise Architect treats the global element and the ComplexType it is referring to as two separate entities.

So, for the above example, Enterprise Architect creates an XSDtopLevelElement stereotyped Class for the global element and an XSDcomplexType stereotyped Class for the ComplexType, and connects them as follows:

 

Global_Import

 

Notes

Enterprise Architect treats the following as two separate entities irrespective of whether the Import global elements with "Type" postfix checkbox is selected or unselected:

 

<xs:element name="HomeAddress" type="AddressType"/>

<xs:complexType name="AddressType">

     <xs:sequence/>

</xs:complexType>

 

Learn more