Creating output files

www.altova.com Print this Topic Previous Page Up One Level Next page

Home >  User Guide and Reference > Code Generator > SPL (Spy Programming Language) >

Creating output files

These statements are used to create output files from the code generation. Remember that all of these statements must be inside a block delimited by square brackets.

 

create

 

create filename

 

creates a new file. The file has to be closed with the close statement. All following output is written to the specified file.

 

Example:

 

[create $outputpath & "/" & $JavaPackageDir & "/" & $application.Name & ".java"]

package [=$JavaPackageName];

 

public class [=$application.Name]Application {

...

}

[close]

 

 

close

 

closes the current output file.

 

=$variable

 

writes the value of the specified variable to the current output file.

 

Example:

 

[$x = 20+3]

The result of your calculation is [=$x] - so have a nice day!

 

The file output will be:

 

The result of your calculation is 23 - so have a nice day!

 

write

 

write string

 

writes the string to the current output file.

 

Example:

 

[write "C" & $name]

 

This can also be written as:

 

C[=$name]

 

filecopy ... to ...

 

filecopy source to target

 

copies the source file to the target file, without any interpretation.

 

Example:

 

filecopy "java/mapforce/mapforce.png" to $outputpath & "/" & $JavaPackageDir & "/mapforce.png"


© 2019 Altova GmbH