Domain Model Entities generated from XSD not as expected
I have imported an XSD to generate Domain Model Entities, however the generated Entities do not match what I would expect to be created. 1. The Mendix Association names (link between two Entities) does not match element name in the XSD From the below XSD, the Association name should be ‘children’ but instead is ‘ChildObject_SampleObject’ 2. The arrows on the Mendix Associations are backwards The arrow for children (ChildObject_SampleObject) should go from the SampleObject Entity to the ChildObject Entity. 3. The Mendix Attribute name is capitalized from what is in the XSD The Mendix Entity is created with an attribute with the name ‘MyName’ instead of the expected ‘myName’ It would be nice if the XSD documentation element were added to the generated Medix Entities The below schema has a documentation element for the different elements. This information is lost when importing into Mendix. <xsd:element name="SampleObject"> <xsd:complexType> <xsd:annotation> <xsd:documentation><![CDATA[A Sample Object]]></xsd:documentation> </xsd:annotation> <xsd:sequence> <xsd:element name="children" type="tns:ChildObject" minOccurs="0" maxOccurs="unbounded"> <xsd:annotation> <xsd:documentation><![CDATA[The child elements]]></xsd:documentation> </xsd:annotation> </xsd:element> </xsd:sequence> <xsd:attribute name="myName" type="xsd:string" use="required"> <xsd:annotation> <xsd:documentation><![CDATA[My Name]]></xsd:documentation> </xsd:annotation> </xsd:attribute> </xsd:complexType> </xsd:element> <xsd:complexType name="ChildObject"> <xsd:attribute name="name" type="xsd:string" use="required" /> <xsd:attribute name="relationship" type="xsd:string" use="required" /> </xsd:complexType>
If you set the maximum occurence of child object to unbounded, the child object needs to be on the many side of your association. It makes perfect sense to have a *-1 association from child to sample.
The other “problems” seem to be based on the regular naming conventions of mendix (capital letter at the beginning, association naming). Does this result in any problem? Usually, you use a mapping to import/export data from/to xml. That means, it does not really matter how all this is called in the mendix domain model.
The generated entities are meant of one example of a domain model that the XSD could map to. You can change it however you want.