Altova XMLSpy 2025 Enterprise Edition

Open content models are new to XSD 1.1. They are declared on complex types and allow any element (that is, an element undefined in the content model of the complex type) to occur any number of times either (i) between elements defined in the content model, or (ii) after elements defined in the content model.

 

The openContent element is a child of the complex type and occurs once before the content model of the complex type (see screenshot below).

 

Mode

The openContent element has a mandatory mode attribute, which can take the values interleave, suffix, or none (see screenshot below). The default value is interleave.

OpenContentModel01

The significance of these values is as follows:

 

If mode="interleave" or mode="suffix", then wildcard element content (xs:any) with no minimum or maximum number of occurrences must be present. This implies that any number of undefined elements (wildcards) is allowed.

If the mode is interleave, any number of undefined elements can occur before or after individual defined elements in the content model. They are interleaved between defined elements.

If the mode is suffix, any number of undefined elements can occur after the last defined element of the content model.

If the mode is none, no undefined element (xs:any child) may occur; the content model is not open. The none value is used to override the defaultOpenContent element that is scoped on the entire schema.

 

In Content Model View, you add open content as a child of the complex type (via Add Child in the context menu). Specify the mode either by double-clicking in the openContent box in the diagram (see screenshot above) and selecting a value (interleave, suffix, or none), or by selecting a value in the Details entry helper.

 

Wildcard (xs:any) properties

Wildcard properties are specified in the wildcard's Details entry helper. Select the wildcard in the diagram and enter property values in the Details entry helper.

 

Default open content

The defaultOpenContent element is new in XSD 1.1 and specifies that one or more undefined elements can be added to any complex type of mixed or element-only content. It is similar to the openContent element (also new to XSD 1.1), the main difference being that while the openContent element applies to a single complex type, the defaultOpenContent element applies to all complex types in the schema.

 

The defaultOpenContent element is a global component and occurs once in the document (see screenshot below), after Includes, Imports, Redefines, and Overrides, and before the definitions of components. It has a mode attribute which can take a value of either interleave or suffix. The default is interleave.

SchOviewDefOpenContent

The defaultOpenContent element has a content model that you can edit in Content Model View, in exactly the same way as the openContent element is defined (see above). Once declared, the defaultOpenContent element will apply automatically to all complex types in the schema and will be displayed in their content models. In the screenshot below, you can see that the defaultOpenContent has been applied automatically to the OfficeType and Desc complex types.

ContModViewDefOpenContent

To override the defaultOpenContent element when it is applied to a particular complex type, add a child openContent element to that complex type. In the screenshot below, the Desc element with the defaultOpenContent element (see screenshot above) has had an openContent element added to it that overrides the defaultOpenContent element.

ContModViewDefOpenContent02

 

© 2018-2024 Altova GmbH