XML Help (defining associations in the schema)

I am trying to create a complex XML schema, but I am unsure in how I can define the associations between objects. If I have the two objects shown in the schema below, how could I associate many 'Orders' to the 'Contact' object. <?xml version="1.0" encoding="UTF-8"?> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <xsd:element name="Contact"> <xsd:complexType maxOccurs="unbounded"> <xsd:attribute name="Name" type="xsd:string" use="required" /> </xsd:complexType> </xsd:element> <xsd:element name="Orders"> <xsd:complexType> <xsd:attribute name="Item" type="xsd:string" use="required" /> <xsd:attribute name="Amount" type="xsd:integer" use="required" /> </xsd:complexType> </xsd:element> </xsd:schema> I couldn't find any resources in the Mendix documentation, of course I could have missed something, so any resources would be good.
2 answers

Hi Harry,

You can define your "orders" as just complex type and refer it to the element in your main object, so something like :

<xsd:element name="Orders" type="xsd:Orders"/>


More info here:





Thanks for the help, the reference you posted was really useful. In an extension to this, is there a way to have multiple level children - I need to make one that is 4 layers deep.

In Mendix it is not possible to map a recursive structure. If you know that you will have a maximum of 4 levels, then you have to manually map them. The drawback of course is that if you decide to change something, you have to change the mapping in al 4 layers.