Chapter 3 Building an XML model
There are global and local attributes:
Global and local attributes in XDR files
In a model targeted with the XML-Data Reduced language, local attributes are first declared separately, like global attributes (with the <AttributeType> tag and a name attribute), then within their parent element (with the <attribute> tag and a type attribute).
Extract of an XDR file:
You can derive an attribute data type to extend or restrict its values. (Only with a model targeted with XSD)
To display an attribute property sheet, double-click its name or its icon in the Browser tree view.
The General page of an attribute 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 attribute |
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 an attribute in the current model or another model opened in the workspace. A reference allows you to reuse an attribute with all its properties without having to define it again. Use the dropdown listbox to select an attribute in the current model. Use the Browse tool to select an attribute from any model opened in the workspace. If you select an attribute from another model, a shortcut is created with the referencing attribute. When you define a reference, name and code properties are grayed. The name and code are those of the target attribute |
Type | Attribute data type. It must be a qualified name (See Glossary). Use the dropdown listbox to select a built-in data type. Use the Browse tool to select a simple type defined in the current model or another model opened in the workspace |
Embedded Type | If selected, the attribute data type disappears and a <simple type> tag is created in the schema within the <attribute> tag. Only available in a model targeted with XSD |
Derivation | Derivation method for the attribute data type. Used to extend or restrict the values of the attribute data type. When you define a derivation, the data type disappears. You must click Apply and then the Properties tool to select a type, a base type or member types for the corresponding derivation (list, restriction or union). Only available in a model targeted with XSD |
In a model targeted with the XML-Data Reduced language, attributes tags are defined by different attributes:
XDR attribute for an attribute |
Description |
Property or page in attribute property sheet |
---|---|---|
name | To specify the name of a global attribute | Name |
default | To specify a default value for both global and local attributes | Detail page |
dt:type | To specify a data type for a global attribute | Type |
dt:values | To specify a list of available values for a global attribute | Values page |
type | To specify the name of a global attribute as reference for a local attribute | Reference |
Example of an XDR file:
Copyright (C) 2005. Sybase Inc. All rights reserved. |
![]() |