Symbols used in XML Schema diagrams

TDWG working group: Structure of Descriptive Data (SDD)

Note: these notes apply to XML spy schema diagrams up to version 2004. In version 2005 some new features are introduced that are not yet covered in this document.

Element symbols

In the schema design diagrams created with XML Spy, only the elements are drawn. Attributes are (unfortunately) not visible. The cardinality of the element (0..1, 1 exactly, 0..n, 1..n) is indicated by the border of the elements. Optional elements are drawn with a dashed line, required elements with a solid line. A maximum occurrence greater one is indicated by a two stacked boxes.

    cardinality 0-1
Optional element
Min. occurrence = 0,
Max. occurrence = 1
    cardinality 1-1
Required single element
Min. occurrence = 1,
Max. occurrence = 1
    cardinality 1-n
Required repeated element
Min. occurrence = 1,
Max. occurrence = unbounded

The content model of elements is symbolized on the left and right side of the element boxes. The left side indicates whether the element contains a simple type (text, numbers, dates, etc.) or a complex type (further elements). The right side of the element symbol indicates whether it contains child elements or not:

    simple content
simple content
    complex content
complex content
    complex/mixed content
complex content
with child elements
    empty/simple content
no element content
(simple type, attributes
only, or empty element)

Examples

optional empty element
Optional single element without child elements. Minimum Occurrence = 0, Maximum Occurrence = 1, content = complex.

optional element
As above, but with child elements. To see the child elements click on the "plus" at the right side (works only in the diagrams, not in the example above!).

single element
Mandatory single element. Minimum Occurrence = 1, Maximum Occurrence = 1, content = complex, no child elements (i.e. this denotes an empty element). The gray or green text below the element displays the xml-schema annotation associated with the element.

unbounded multiple elements
Mandatory multiple element containing child elements (content = complex). This element must occur at least once (Minimum Occurrence = 1) and may occur as often as desired (Maximum Occurrence = unbounded).

simple text
Mandatory single element with containing simple content (e.g. text) or mixed complex content (e.g. text with xhtml markup). Minimum Occurrence = 1, Maximum Occurrence = 1, type = xsd:string (for example), content = simple. The three lines in the upper left corner are used for both text and numeric content.

Model symbols ("compositors")

sequence A sequence of elements. The elements must appear exactly in the sequence in which they appear in the schema diagram.
choice A choice of elements. Only a single element from those in the choice may appear at this position.
model all The "all" model, in which the sequence of elements is not fixed.

Types

If an element refers to a complex global type, the
type is shown with a border and yellow background.
You can click on the gray type name shown at the
top to jump to the type definition itself.
    complex type
Depending on the settings in xml spy when
generating the schema diagrams, the type
name may be shown in the line below the
element name:
    complex type with type name shown
In that case, the type names of simple
types are shown as well:
    simple type with type name shown

(Note that in some hand-created diagrams the yellow color of types may have been removed.)

Model groups and references

element group
An element group is a named container with one or several elements. The group of elements can be reused at multiple places in the schema. Model groups are invisible in the instance document (in contrast to types, which require). Model groups have been used sparingly since they do not map to a feature in object-oriented programming languages (unless they support multiple inheritance).

Import note on reading the diagrams for model groups: If the model group symbol is drawn with simple lines (i. e. not dashed), this does not imply that the elements in the model group are required. The optionality of the group depends on the optionality of elements contained in the model group. (Model groups can be made optional, e. g. to make a model group with required elements optional in some cases, but this has not been used.)

any placeholder
The "any" group is a special kind of model group. It is a placeholder for elements not defined in the schema. The "any" element defines points where the schema can be extended. After the "Any" keyword the namespace from which the elements may come is defined, for example, "##other" specifies that the extension elements may come from any namespace, except from the current schema namespace.

type
Element references are indicated through a link arrow in the lower left corner. They are similar to references to model groups within a schema, but instead of refing the model group, they directly refer to a single global element. The global element can then be reused in multiple places.

General Notes

Attributes are not shown in the schema diagrams. They are only visible in the section labeled "attributes" below the diagram. The annotation of attributes is visible in the table, but often this the column is not visible on the screen. the best place to find attribute annotations may therefore be the source code!


(Please use the "back"-button of your browser to continue!)

(Gregor Hagedorn)



First published 2003-02-17, last update: 2003-12-03.

Valid XHTML 1.0! Valid CSS1! Viewable With Any Browser