Chapter 3 Building an XML model
There are global and local elements:
Global and local elements in XDR files
In a model targeted with the XML-Data Reduced language, local elements are first declared separately, like global elements (with the <ElementType> tag and a name attribute), then within their parent element (with the <element> tag and a type attribute).
Extract of an XDR file:
Parent elements are linked to their child elements through group particles (sequence, choice or all). A parent element can contain a group of child elements (See Group type in the following table)
You can derive an element data type to extend or restrict its values. (Only with a model targeted with XSD)
The General page of an element property sheet displays the following properties:
Property | Description |
---|---|
Name | The name of the item which should be clear and meaningful, and should convey the item's purpose to non-technical users |
Code | The technical name of the item used for generating code or scripts, which may be abbreviated, and should not generally include spaces |
Comment | Descriptive label of the element |
Stereotype | Sub-classification used to extend the semantics of an object without changing its structure. It can be predefined or user-defined |
Reference | Name of a global element. The current element will have the same properties as the global element. The Reference property is only available for child elements. Use the dropdown listbox to select a global element in the current model. Use the Browse tool to select a global element from any model opened in the current workspace. If you select a global element from another model, a shortcut is created with the referencing element. When you define a reference, name and code properties are grayed. Name and code are those of the global element |
Group type | Indicator that specifies how child elements are to be used within the parent element. It can be a group particle (all, choice, sequence) or a group of elements (group). If you select group, a referencing group is directly linked to the current element (see Defining group properties) |
Type | Element data type. Use the dropdown listbox to select a built-in data type. Use the Browse tool to select a simple or a complex type from any model opened in the current workspace. In the case of an XSD, selecting a data type will delete any group particle (and its child elements) or attribute previously defined in the element property sheet. Do not select a data type if you want to define attributes or child elements within the current element |
Embedded type | Locally defined data type. It applies to the current element only. Automatically set to Complex if you define a derivation for the element data type. Only available in a model targeted with XSD |
Content | Content type of the element. If you select Complex, the element can have child elements. If you select Simple, the element cannot have child elements. Only available in a model targeted with XSD |
Derivation | Derivation method for the element data type. Used to extend or restrict the values of the element data type. When you define a derivation, the data type disappears. You must click Apply and then the Properties tool to select a base type in the derivation property sheet. Only available in a model targeted with XSD |
For more information on group particles, see section Linking child elements to a parent element.
For more information on derivations, see section Defining derivations.
Once you have defined the reference of a referencing element, you can locate the referenced element in the diagram by right-clicking the referencing element symbol and selecting Find Referenced Element in the contextual menu. The referenced element appears with handles in the diagram.
In a model targeted with the XML-Data Reduced language, elements are defined by different attributes:
XDR attribute for an element |
Description |
Property or page in element property sheet |
---|---|---|
Model | To specify if a global element can contain new local elements. Set to closed by default. Set to open if an Any symbol is attached to the element symbol | — |
Content | To specify the content of a global element. If a group particle and a data type are defined, the content value is mixed. If a group particle and no data type is defined, the content value is eltOnly. If no group particle and a data type is defined, the content value is textOnly. If no group particle or data type is defined, the content value is empty | Group type, Type |
Order | To specify how local elements are organized within a global element. Set to seq for a sequence group particle. Set to one for a choice group particle. Set to many for an All group particle | Group type |
dt:type | To specify a data type for a global element | Type |
dt:values | To specify a list of available values for a global element | Values page |
type | To specify the name of a global element as reference for a local element | Reference |
minOccurs | To specify the minimum number of occurrences for a local element. Usually set to 0 or 1 | Detail page in local element property sheet |
maxOccurs | To specify the maximum number of occurrences for a local element. Usually set to 1 or * (unbounded) | Detail page in local element property sheet |
Example of an XDR file:
Copyright (C) 2005. Sybase Inc. All rights reserved. |
![]() |