Complex types
You can use mixed content in a schema and an XML document.
Mixed content in a schema and XML document
This example demonstrates the use of mixed content in a schema and an XML document. The schema contains an element of type int and an element of type string.
Here is the schema:
<element name="observation">
<complexType mixed="true">
<sequence>
<element name="temperature" type="int">
<element name="city" type="string">
</sequence>
...
</complexType>
</element>
Here is the excerpt from an XML document:
<observation>
It is <temperature>10</temperature>degrees in <city>London</city>.
</observation>
And here is the XOM representation:
class Observation extends IlrXmlObject
{
int temperature;
String city;
String content;
}
The content of the observation element is translated to a single String that concatenates all the strings and put in a special attribute named content.
Complex type mapping
The following table shows some complex type mappings between a schema and dynamic model.
| Case | Schema | Dynamic model |
|---|---|---|
| Element with local complex type of unary component |
|
|
| Element with local complex type of unary component |
|
|
| Typed element |
|
|
| Typed element with collection group |
|
|
| Local complex type: when inner classes are permitted |
|
|
| Local complex type: when inner classes are not permitted |
|
|
Simple content mapping
The following table shows some simple content mappings between a schema and dynamic model.
| Case | Schema | Dynamic model |
|---|---|---|
| Complex type with simple content |
|
|
| Complex type inheriting by extension from complex type with simple content |
|
|
| Complex type inheriting by restriction from complex type with simple content |
|
|
Complex content mapping
The following table shows some complex content mappings between a schema and dynamic model.
| Case | Schema | Dynamic model |
|---|---|---|
| Complex type inheriting by extension |
|
|
| Complex type inheriting by restriction |
|
|
| Complex type with mixed content, inheriting by extension |
|
|