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. XMap
  7. Libraries
  8. Schema Object
  9. Command Line Interface
  10. Scripts
  11. Parsers
  12. Script Ports
  13. Document Processors
  14. Formats
  15. Data Holders
  16. Anchors
  17. Transformers
  18. Actions
  19. Serializers
  20. Mappers
  21. Locators, Keys, and Indexing
  22. Streamers
  23. Validators, Notifications, and Failure Handling
  24. Validation Rules
  25. Custom Script Components

Data Transformation User Guide

Data Transformation User Guide

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.