HOPEX UML : HOPEX XML Schemas : Creating an XML Schema : References : Creating a Reference in an XML Schema
   
Creating a Reference in an XML Schema
In the schema editor, the reference can only be created from an element.
To create a reference:
*Select the Access by Reference check box in the create element dialog box.
*See "Creating an Element".
or:
*In the navigator, click the element that is to be defined as a reference.
*In the right part of the editor, in the Characteristics subtab, select the Access by reference check box.
Result
 
Diagram
Diagram
XML Document
<Person Account="1306" Name="Smith"/>
 
<BankAccount id="1306"/>
Operating principle
The element defined as the reference will automatically have an attribute to identify it: the id attribute, of type ID.
*This type is defined by XML and is therefore available in all the schema languages.
The tag definition referring to this element will automatically define an attribute of type IDREF or IDREFS (depending on the multiplicity), whose value will be the value of the id attribute for the referenced element.
By default, the id attribute is added to all tag instances of the tag definition.
*Whether this identifying attribute is added is determined by the value of the parameter XDD compulsory ID attribute. The default value (yes) indicates that the attribute is to be added.
Example
When a class A references a class B, an attribute of type IDREF (or IDREFS depending on the multiplicity of the reference) is added to class A. The value of this attribute must correspond to the value of the ID attribute for tag B.
 
Diagram
XML Document
<A id="25", B="123"/>
<B id="123"/>
 
UML modeling
The reference is represented by an association comparable to that used for declaration of an element. The only difference is in the nature of the association: it is not a composition.
*Create an association between the referenced class and the class that references it.
*Right-click the referencing role and select Aggregation > No (default value).