Map function

You can design a dynamic type when its related schema type is known. Schema member names translate to dynamic class field names according to certain rules.

The map function is used to design a dynamic type when its related schema type is known.

  • If T is a complex type, map(T) represents the dynamic class related to T.

  • If T is an atomic simple type, map(T) represents its mapped dynamic type by following these rules:

    1. If T is a built-in type, the dynamic type is given by XXX.

    2. map (T) = map (base (T)) where base(T) is the direct base simple type of T.

Example of a map function

With a simple type MyT defined as:

<simpleType name="MyT">
  <restriction base="string">
</simpleType>

You have, map(MyT) = java.lang.String.

The following expression:

class C 
{ 
 [map(MyT)] myField;
}

Stands for:

class C
{
  java.lang.String myField;
}

Translation of schema member names to dynamic class field names

Schema member names translate to dynamic class field names according to a number of rules.

A schema member name is translated into a dynamic class field name according to the following rules:
  • If you reference a package, class or attribute that is a Java keyword, place the word in back quotes. You can then use names that cannot be parsed directly as identifiers.
  • The first type letter is translated into lowercase.
  • All characters that could be contained in a Java™ identifier are translated without change.
  • The other characters are discarded and the next letter is translated into uppercase.
  • If the resulting member name is already used as a member identifier, a numeric suffix is appended to that name. For example, field becomes field_0.
Following these rules, my-address becomes myAddress.