Liquid XML Studio
KeyRef
Send Feedback
XSD Editor > Graphical Notation Overview > KeyRef

Glossary Item Box

Graphical Representation

KeyRef Notation

Summary

The <keyRef> element defines a reference to a key or unique constraint.

Creating

A <keyRef> can only be added to an element object. This can be done using the right click context menu on any of these entities.

Properties

KeyRef Properties

Id - A user defined ID to uniquely identify the entity within the schema
Name - the name of the key.
Refer - the key or unique constraint to which this constraint refers.
XPath Fields - 1 or more XPath expressions that uniquely identify selected element.
XPath Selector - The XPath expression that identifies the element to which this key applies.

Sample

The following XSD code


<?
xml version="1.0" encoding="utf-8" ?>


<!--
Created with Liquid XML Studio (https://www.liquid-technologies.com)-->


<
xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">


<
xs:element name="library">


<
xs:complexType>


<
xs:sequence>


<
xs:element name="Book">


...


</
xs:element>


</
xs:sequence>


</
xs:complexType>


<
xs:key name="ID">


<
xs:selector xpath="Book|Author|Character" />


<
xs:field xpath="@id" />


</
xs:key>


<
xs:keyref name="IDREF" refer="ID">


<
xs:selector xpath="Book/Author-Ref|Book/Character-Ref" />


<
xs:field xpath="@ref" />


</
xs:keyref>


</
xs:element>


</
xs:schema>






Will be represented like this

KeyRef Samples

ShowInline Properties

Properties that apply to a type are shown inline at the bottom of the items container.

Values that are inherited from the base types are shown in brackets, values specifically set against the item are shown without brackets.

If a facet is not valid for a given type (typically because of its data type), then its value is shown in red.

Inline properties can be disabled in the Options.