Any non-trivial SPL file will require variables. Some variables are predefined by the code generator, and new variables may be created simply by assigning values to them.
The $ character is used when declaring or using a variable, a variable name is always prefixed by $. Variable names are case sensitive.
•integer - also used as boolean, where 0 is false and everything else is true
•object - provided by XMLSpy
•iterator - see foreach statement
Variable types are declared by first assignment:
[$x = 0]
x is now an integer.
[$x = "teststring"]
x is now treated as a string.
String constants are always enclosed in double quotes, like in the example above. \n and \t inside double quotes are interpreted as newline and tab, \" is a literal double quote, and \\ is a backslash. String constants can also span multiple lines.
String concatenation uses the & character:
[$BasePath = $outputpath & "/" & $JavaPackageDir]
Objects represent the information contained in the XML schema. Objects have properties, which can be accessed using the . operator. It is not possible to create new objects in SPL (they are predefined by the code generator, derived from the input schema), but it is possible to assign objects to variables.
This example outputs the word "class", followed by a space and the value of the Name property of the $class object.