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

User Guide

User Guide

Mapping XSI Types

Mapping XSI Types

A schema can define derived data types that can be used in place of a base type. In such cases, an XML document can define the actual data type of an element by specifying an
xsi:type
attribute.
For example, a schema defines a
Person
element having a type
PersonT1
and containing string content. It defines a type called
PersonT2
that extends
PersonT1
by adding an
Id
attribute. The following are valid
Person
elements:
<!-- base type PersonT1 --> <Person>Ron Lehrer</Person> <!-- derived type PersonT2 --> <Person Id="547329876" xsi:type="PersonT2">Ron Lehrer</Person>
The Script interprets
xsi:type
attributes in input XML documents. It adds
xsi:type
attributes where necessary to output XML documents.
Select the appropriate type according to the data that the transformation processes. For example, if you want a
Content
anchor to store data in a
Person
element having type
PersonT2
, select
xsi:type=PersonT2
. The selection appears in the Script as follows:
data_holder=/Person/*c/xsi:type=PersonT2
In cases where the content might require either a
PersonT1
or
PersonT2
data holder, you can configure an
Alternatives
anchor that contains two
Content
anchors. One of the
Content
anchors is mapped to
PersonT1
, and the other to
PersonT2
. For more information, see Alternatives.
If you map a data holder to the unqualified element
Person
, the data holder defaults to the base type
PersonT1
. Thus the following mappings are equivalent:
data_holder=/Person data_holder=/Person/*c/xsi:type=PersonT1

0 COMMENTS

We’d like to hear from you!