attribute to set the maximum number of times that sibling elements can occur in an XML document. Likewise, you can define a variable that can occur either once or multiple times. An element or variable that can occur only once is called a single-occurrence data holder. An element or variable that can occur more than once is called a multiple-occurrence data holder.
Single- and multiple-occurrence data holders behave differently when the Script stores data in them, for example, when you map
anchors to a data holder.
In a single-occurrence data holder, each assignment overwrites the preceding assignment.
In a multiple-occurrence data holder, each assignment generates a new occurrence of the data holder.
To understand this, suppose that a schema defines an XML element called
maxOccurs = 1
, this is a single-occurrence data holder. If a Parser maps more than one
anchor to the
element, the output contains only the final mapping.
Consider what would happen if you parse a source document that is a list of first names:
Jack Jennie Larissa
We assume that each name is a
anchor mapped to
. Each name overwrites the value of
. The output contains only the mapping:
Now suppose that
maxOccurs = unbounded
. This means that
is a multiple-occurrence data holder. If you map multiple
anchors to the element, the Parser generates a list of names. The output is:
The same principle applies to variables. If you map multiple anchors to a multiple-occurrence variable, each anchor generates a new occurrence of the variable. You can use this feature, for example, to prepare input for the
actions, which concatenate the occurrences.
The behavior described here assumes that the multiple-occurrence data holder has a simple data type. Under certain circumstances, if the type is complex, each anchor might not generate a new occurrence. To control this behavior, you can use a locator. For more information, see
Overview of Locators, Keys, and Indexing.