Generating XML document with certain elements optional

I need to generate a rather complicated XML. Certain elements of the XML should be in- or excluded depending on the characteristics of the objects to map to the XML (e.g. housenumber suffix must be included when it exists. It should be excluded when it does not exist). Is there a way to do this using standard functionality other than creating separate Domain-XML mappings and using one or the other depending on the characteristics?
1 answers

If you map an attribute onto an optional XML element (minOccurs="0" maxOccurs="1") and the value of the attribute is empty (not ''), the element will automatically be left out of the resulting XML document by Mendix domain-to-XML mappings.