Source (XML):
<xsd:element name="letterBody">
<xsd:complexType
mixed="true">
<xsd:element
name="salutation">
<xsd:complexType mixed="true">
<xsd:element name="name"
type="xsd:string"/>
<xsd:element
name="quantity" type="xsd:positiveInteger"/>
<xsd:element name="productName" type="xsd:string"/>
<xsd:element name="shipDate" type="xsd:date"
minOccurs="0"/>
<xsd:complexType name="USAddress"
>
<xsd:element name="name"
type="xsd:string"/>
<xsd:element name="street" type="xsd:string"/>
<xsd:element name="city"
type="xsd:string"/>
<xsd:element name="state" type="xsd:string"/>
<xsd:element name="zip"
type="xsd:decimal"/>
<xsd:attribute
name="country" type="xsd:NMTOKEN"
fixed="US"/>
<xsd:complexType name="Items">
<xsd:element name="item" minOccurs="0" maxOccurs="unbounded">
<xsd:element name="productName" type="xsd:string"/>
<xsd:restriction
base="xsd:positiveInteger">
<xsd:maxExclusive
value="100"/>
<xsd:element name="USPrice" type="xsd:decimal"/>
<xsd:element
ref="comment" minOccurs="0"/>
type="xsd:date" minOccurs="0"/>
<xsd:attribute name="partNum" type="SKU"
use="required"/>
<xsd:element name="internationalPrice">
<xsd:restriction base="xsd:anyType">
<xsd:attribute
name="currency" type="xsd:string"/>
<xsd:attribute name="value" type="xsd:decimal"/>
<xsd:complexType name="PurchaseOrderType">
<xsd:group ref="shipAndBill"/>
<xsd:element name="singleUSAddress" type="USAddress"/>
<xsd:element ref="comment" minOccurs="0"/>
<xsd:element
name="items" type="Items"/>
<xsd:attribute name="orderDate" type="xsd:date"/>
<xsd:element name="shipTo" type="USAddress"/>
<xsd:element name="billTo" type="USAddress"/>
<?xml
version="1.0" encoding="UTF-8"?>
<kdm:Segment
xmi:version="2.1"
xmlns:xmi="http://www.omg.org/XMI"
xmlns:code="http://kdm.omg.org/code"
xmlns:data="http://kdm.omg.org/data"
xmlns:kdm="http://kdm.omg.org/kdm"
name="XML
Complex Content Example">
<model xmi:id="id.0"
xmi:type="data:DataModel">
<dataElement
xmi:id="id.1" xmi:type="data:XMLSchema" name="Complex
Content">
<contentElement
xmi:id="id.2" xmi:type="data:SimpleContentType"
name="SKU" type="id.68" kind="restriction">
<contentElement
xmi:id="id.3" xmi:type="data:ContentRestriction"
kind="pattern"
value=""\d{3}-[A-Z]{2}""/>
</contentElement>
<contentElement
xmi:id="id.4" xmi:type="data:ContentElement"
name="letterBody" type="id.5">
<contentElement xmi:id="id.5"
xmi:type="data:MixedContent"
name="m1">
<contentElement
xmi:id="id.6" xmi:type="data:SeqContent">
<contentElement
xmi:id="id.7" xmi:type="data:ContentElement"
name="salutation" type="id.8">
<contentElement
xmi:id="id.8" xmi:type="data:MixedContent"
name="m2">
<contentElement
xmi:id="id.9" xmi:type="data:SeqContent">
<contentElement
xmi:id="id.10" xmi:type="data:ContentElement"
name="name" type="id.68"/>
</contentElement>
</contentElement>
</contentElement>
<contentElement
xmi:id="id.11" xmi:type="data:ContentElement"
name="quantity" type="id.72"/>
<contentElement
xmi:id="id.12" xmi:type="data:ContentElement"
name="productName"
type="id.68"/>
<contentElement
xmi:id="id.13" xmi:type="data:ContentElement"
name="shipDate" type="id.74"/>
</contentElement>
</contentElement>
</contentElement>
<contentElement
xmi:id="id.14" xmi:type="data:ComplexContentType"
name="USAddress">
<contentElement
xmi:id="id.15" xmi:type="data:SeqContent">
<contentElement
xmi:id="id.16" xmi:type="data:ContentElement"
name="name" type="id.68"/>
<contentElement
xmi:id="id.17" xmi:type="data:ContentElement"
name="street" type="id.68"/>
<contentElement
xmi:id="id.18" xmi:type="data:ContentElement"
name="city" type="id.68"/>
<contentElement
xmi:id="id.19" xmi:type="data:ContentElement"
name="state" type="id.68"/>
<contentElement
xmi:id="id.20" xmi:type="data:ContentElement"
name="zip" type="id.68"/>
</contentElement>
<contentElement
xmi:id="id.21" xmi:type="data:ContentAttribute"
name="country" type="id.77">
<contentElement
xmi:id="id.22" xmi:type="data:ContentRestriction"
kind="fixed" value=""US""/>
</contentElement>
</contentElement>
<contentElement
xmi:id="id.23" xmi:type="data:ComplexContentType"
name="items">
<contentElement
xmi:id="id.24" xmi:type="data:SeqContent">
<contentElement
xmi:id="id.25" xmi:type="data:ContentElement"
name="item" type="id.28">
<contentElement
xmi:id="id.26" xmi:type="data:ContentRestriction"
kind="minOccurs" value="0"/>
<contentElement
xmi:id="id.27" xmi:type="data:ContentRestriction"
kind="maxOccurs"
value="unbounded"/>
<contentElement
xmi:id="id.28" xmi:type="data:ComplexContentType"
name="i">
<contentElement
xmi:id="id.29" xmi:type="data:SeqContent">
<contentElement
xmi:id="id.30" xmi:type="data:ContentElement"
name="productName1" type="id.68"/>
<contentElement
xmi:id="id.31" xmi:type="data:ContentElement"
name="quantity1" type="id.32">
<contentElement
xmi:id="id.32" xmi:type="data:SimpleContentType"
name="st1" type="id.72" kind="restriction">
<contentElement xmi:id="id.33"
xmi:type="data:ContentRestriction"
kind="maxExclusive"
value="100"/>
</contentElement>
</contentElement>
<contentElement
xmi:id="id.34" xmi:type="data:ContentElement"
name="USPrice" type="id.70"/>
<contentElement
xmi:id="id.35" xmi:type="data:ContentReference">
<dataRelation
xmi:id="id.36" xmi:type="data:ReferenceTo"
to="id.64" from="id.35"/>
<contentElement
xmi:id="id.37" xmi:type="data:ContentRestriction"
kind="minOccurs" value="0"/>
</contentElement>
<contentElement
xmi:id="id.38" xmi:type="data:ContentElement"
name="shipDate1" type="id.74"/>
</contentElement>
<contentElement
xmi:id="id.39" xmi:type="data:ContentAttribute"
name="partNum" type="id.2">
<contentElement
xmi:id="id.40" xmi:type="data:ContentRestriction"
kind="use" value="required"/>
</contentElement>
</contentElement>
</contentElement>
</contentElement>
</contentElement>
<contentElement
xmi:id="id.41" xmi:type="data:ContentElement"
name="international price" type="id.42">
<contentElement
xmi:id="id.42" xmi:type="data:ComplexContentType"
name="j">
<dataRelation xmi:id="id.43"
xmi:type="data:RestrictionOf"
to="id.76" from="id.42"/>
<contentElement
xmi:id="id.44" xmi:type="data:ContentAttribute"
name="currency1" type="id.68"/>
<contentElement
xmi:id="id.45" xmi:type="data:ContentAttribute"
name="value" type="id.70"/>
</contentElement>
</contentElement>
<contentElement
xmi:id="id.46" xmi:type="data:ComplexContentType"
name="PurchaseOrderType">
<contentElement
xmi:id="id.47" xmi:type="data:SeqContent">
<contentElement
xmi:id="id.48" xmi:type="data:ChoiceContent">
<contentElement
xmi:id="id.49" xmi:type="data:ContentReference">
<dataRelation
xmi:id="id.50" xmi:type="data:ReferenceTo"
to="id.58" from="id.49"/>
</contentElement>
<contentElement
xmi:id="id.51" xmi:type="data:ContentElement"
name="singleUSAddress" type="id.14">
<dataRelation
xmi:id="id.52" xmi:type="data:TypedBy"
to="id.14" from="id.51"/>
</contentElement>
</contentElement>
<contentElement
xmi:id="id.53" xmi:type="data:ContentReference">
<dataRelation
xmi:id="id.54" xmi:type="data:ReferenceTo"
to="id.64" from="id.53"/>
<contentElement
xmi:id="id.55" xmi:type="data:ContentRestriction"
kind="minOccurs" value="0"/>
</contentElement>
<contentElement
xmi:id="id.56" xmi:type="data:ContentElement"
name="items" type="id.23"/>
</contentElement>
<contentElement
xmi:id="id.57" xmi:type="data:ContentAttribute"
name="orderDate"
type="id.74"/>
</contentElement>
<contentElement
xmi:id="id.58" xmi:type="data:GroupContent"
name="shipAndBill">
<contentElement
xmi:id="id.59" xmi:type="data:SeqContent">
<contentElement
xmi:id="id.60" xmi:type="data:ContentElement"
name="shipTo" type="id.14">
<dataRelation
xmi:id="id.61" xmi:type="data:TypedBy"
to="id.14" from="id.60"/>
</contentElement>
<contentElement
xmi:id="id.62" xmi:type="data:ContentElement"
name="billTo" type="id.14">
<dataRelation
xmi:id="id.63" xmi:type="data:TypedBy"
to="id.14" from="id.62"/>
</contentElement>
</contentElement>
</contentElement>
<contentElement
xmi:id="id.64" xmi:type="data:ContentElement"
name="comment" type="id.68"/>
</dataElement>
<dataElement
xmi:id="id.65" xmi:type="data:XMLSchema"
name="xsd">
<contentElement
xmi:id="id.66" xmi:type="data:SimpleContentType"
name="xsd:Integer">
<dataRelation
xmi:id="id.67" xmi:type="data:DatatypeOf"
to="id.80" from="id.66"/>
</contentElement>
<contentElement
xmi:id="id.68" xmi:type="data:SimpleContentType"
name="xsd:String">
<dataRelation
xmi:id="id.69" xmi:type="data:DatatypeOf"
to="id.81" from="id.68"/>
</contentElement>
<contentElement
xmi:id="id.70" xmi:type="data:SimpleContentType"
name="xsd:Decimal">
<dataRelation
xmi:id="id.71" xmi:type="data:DatatypeOf"
to="id.82" from="id.70"/>
</contentElement>
<contentElement
xmi:id="id.72" xmi:type="data:SimpleContentType"
name="xsd:positiveInteger">
<dataRelation
xmi:id="id.73" xmi:type="data:DatatypeOf"
to="id.80" from="id.72"/>
</contentElement>
<contentElement
xmi:id="id.74" xmi:type="data:SimpleContentType"
name="xsd:date">
<dataRelation
xmi:id="id.75" xmi:type="data:DatatypeOf"
to="id.83" from="id.74"/>
</contentElement>
<contentElement
xmi:id="id.76" xmi:type="data:SimpleContentType"
name="xsd:any"/>
<contentElement
xmi:id="id.77" xmi:type="data:SimpleContentType"
name="xsd:NMTOKEN"/>
</dataElement>
</model>
<model xmi:id="id.78" xmi:type="code:CodeModel">
<codeElement
xmi:id="id.79" xmi:type="code:LanguageUnit">
<codeElement
xmi:id="id.80" xmi:type="code:IntegerType" name="xsd
integer"/>
<codeElement
xmi:id="id.81" xmi:type="code:StringType" name="xsd
string"/>
<codeElement xmi:id="id.82"
xmi:type="code:DecimalType" name="xsd decimal"/>
<codeElement
xmi:id="id.83" xmi:type="code:DateType" name="xsd
date"/>
</codeElement>
</model>
</kdm:Segment>