In designing a transformation, a frequent issue is how to locate the data holders that you want to process. If the same data holders can occur multiple times in an XML structure, there can be ambiguities in identifying the occurrences. This chapter explains how to use the
Locator
and
Key
components to resolve the ambiguities.
The components described in this chapter let you identify the occurrences of multiple-occurrence data holders in three ways:
Sequentially. Each iteration of a component processes the next occurrence of the data holder.
By occurrence number. For example, a component can select the third occurrence of a data holder.
By a key such as an attribute or a nested element. The key uniquely identifies the occurrence of the data holder.
The sequential approach is the default. It is subject to some complexities that you can control by using the
Locator
component.
The occurrence number and key approaches are collectively known as indexing. The term is analogous to the index of a book, where you use a page number or a subject key to identify the location of information. You can implement the indexing by using components called
LocatorByOccurrence
,
LocatorByKey
, and
Key
.
You can use the locator and key components in parsers, serializers, or mappers. You can use the components to identify the occurrences of data holders in the input, the output, or both.
The locator components are nested in the
source
and
target
properties of various transformation components. The meaning and usage of the