Altova XMLSpy 2024 Enterprise Edition

Referencing Global Elements

Home Prev Top Next

In this section, we will convert the locally defined Person element to a global element and reference that global element from within the Company element.


1.Click ic_back2global (Display All Globals) to switch to Schema Overview.

2.Click the Display Diagram icon ic_component of the Company element.

3.Right-click the Person element, and select Make Global | Element. A small link arrow icon appears in the Person element, showing that this element now references the globally declared Person element. In the Details Entry Helper, the isRef check box is now activated.


4.Click the Display All Globals icon ic_back2global to return to Schema Overview. The Person element is now listed as a global element. It is also listed in the Components Entry Helper.


5.In the Components Entry Helper, double-click the Person element to see the content model of the global Person element.


Notice that the global element box does not have a link arrow icon. This is because it is the referenced element, not the referencing element. It is the referencing element that has the link arrow icon.


Note the following:


An element that references a global element must have the same name as the global element it references.

A global declaration does not describe where a component is to be used in an XML document. It only describes a content model. It is only when a global declaration is referenced from within another component that its location in the XML document is specified.

A globally declared element can be reused at multiple locations. It differs from a globally declared complex type in that its content model cannot be modified without also modifying the global element itself. If you change the content model of an element that references a global element, then the content model of the global element will also be changed, and, with it, the content model of all other elements that reference that global element.


© 2018-2024 Altova GmbH