Table of Contents

Search

  1. Preface
  2. Introduction to Data Transformation
  3. Data Processor Transformation
  4. Wizard Input and Output Formats
  5. Relational Input and Output
  6. Using the IntelliScript Editor
  7. XMap
  8. Libraries
  9. Schema Object
  10. Command Line Interface
  11. Scripts
  12. Parsers
  13. Script Ports
  14. Document Processors
  15. Formats
  16. Data Holders
  17. Anchors
  18. Transformers
  19. Actions
  20. Serializers
  21. Mappers
  22. Locators, Keys, and Indexing
  23. Streamers
  24. Validators, Notifications, and Failure Handling
  25. Validation Rules
  26. Custom Script Components

Data Transformation User Guide

Data Transformation User Guide

Multiple-Occurrence Data Holders

Multiple-Occurrence Data Holders

In a schema, you can use the
maxOccurs
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
Content
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
<FirstName>
. If
maxOccurs = 1
, this is a single-occurrence data holder. If a Parser maps more than one
Content
anchor to the
<FirstName>
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
Content
anchor mapped to
FirstName
. Each name overwrites the value of
FirstName
. The output contains only the mapping:
<FirstName>Larissa</FirstName>
Now suppose that
maxOccurs = unbounded
. This means that
FirstName
is a multiple-occurrence data holder. If you map multiple
Content
anchors to the element, the Parser generates a list of names. The output is:
<FirstName>Jack</FirstName> <FirstName>Jennie</FirstName> <FirstName>Larissa</FirstName>
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
AppendListItems
and
CombineValues
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.


Updated September 26, 2018