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

Destroying the Occurrences

Destroying the Occurrences

Under certain circumstances, you might want to destroy all existing occurrences of a multiple-occurrence data holder, and start creating new occurrences from the beginning of the list. This is useful, for example, if you are parsing an iterative structure, and you want to keep only the last iteration. You can destroy the occurrences that store data from the earlier iterations.
You can achieve this effect by defining a single-occurrence data holder that contains a nested, multiple-occurrence element. When you re-use the single-occurrence data holder, the nested occurrences are destroyed.
The following scenario is a typical example.
  1. Add the following schema to a project:
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified"> <xs:complexType name="MyListType"> <xs:sequence> <xs:element name="item" type="xs:string" maxOccurs="unbounded"/> </xs:sequence> </xs:complexType> </xs:schema>
    The schema defines a custom data type called
    MyListType
    . The type contains a nested, multiple-occurrence element called
    item
    .
  2. Define a single-occurrence variable called
    MyList
    , which has the data type
    MyListType
    .
  3. Use the variable as the target of an iterative structure.
    For more information, see Overview of Locators, Keys, and Indexing.
    Each iteration re-uses the single occurrence of
    MyList
    . At the start of the iteration, the nested
    item
    elements are destroyed. Anchors within the iterative structure, such as a nested
    RepeatingGroup
    , start assigning the
    item
    elements from the beginning of the list.


Updated March 03, 2021