Declarations

www.altova.com Imprimer cette rubrique Page précédente Un niveau supérieur Page suivante

Accueil >  Manuel de l'utilisateur et référence > Code Generator > SPL (Spy Programming Language) >

Declarations

The following statements are evaluated while parsing the SPL template file. They are not affected by flow control statements like conditions, loops or subroutines, and are always evaluated exactly once.

 

These keywords, like all keywords in SPL, are not case sensitive.

 

Remember that all of these declarations must be inside a block delimited by square brackets.

 

map ... to ...

 

map mapname key to value [, key to value ]...

 

This statement adds information to a map. See below for specific uses.

 

map schemanativetype schematype to typespec

 

The specified built-in XML Schema type will be mapped to the specified native type or class, using the specified formatter. This setting applies only to code generation for version 2007r3 and higher. Typespec is a native type or class name, followed by a comma, followed by the formatter class instance.

 

Example:

 

map schemanativetype "double" to "double,Altova::DoubleFormatter"

 

map type ... to ...

 

map type schematype to classname

 

The specified built-in XML Schema type will be mapped to the specified class. This setting applies only to code generation for version 2007 or lower.

 

Example:

 

map type "float" to "CSchemaFloat"

 

default ... is ...

 

default setting is value

 

This statement allows you to affect how class and member names are derived from the XML Schema. Note that the setting names are case sensitive.

 

Example:

 

default "InvalidCharReplacement" is "_"

 

Setting name

Explanation

ValidFirstCharSet

Allowed characters for starting an identifier

ValidCharSet

Allowed characters for other characters in an identifier

InvalidCharReplacement

The character that will replace all characters in names that are not in the ValidCharSet

AnonTypePrefix

Prefix for names of anonymous types*

AnonTypeSuffix

Suffix for names of anonymous types*

ClassNamePrefix

Prefix for generated class names

ClassNameSuffix

Suffix for generated class names

EnumerationPrefix

Prefix for symbolic constants declared for enumeration values

EnumerationUpperCase

"on" to convert the enumeration constant names to upper case

FallbackName

If a name consists only of characters that are not in ValidCharSet, use this one

 

* Names of anonymous types are built from AnonTypePrefix + element name + AnonTypeSuffix

 

reserve

 

reserve word

 

Adds the specified word to the list of reserved words. This ensures that it will never be generated as a class or member name.

 

Example:

 

reserve "while"

 

include

includes the specified file as SPL source. This allows you to split your template into multiple files for easier editing and handling.

 

include filename

 

Example:

 

include "Module.cpp"


© 2018 Altova GmbH