This section gives an overview of SPL (Spy Programming Language), the code generator's template language.
It is assumed that you have prior programming experience, and are familiar with operators, functions, variables and classes, as well as the basics of object-oriented programming - which is used heavily in SPL. You should also have detailed knowledge of XML Schema.
The templates used by XMLSpy are supplied in the ...\XMLSpy\spl folder. You can use these files as an aid to help you in developing your own templates.
How code generator works
Inputs to the code generator are the template files (.spl) and the object model provided by XMLSpy. The template files contain SPL instructions for creating files, reading information from the object model and performing calculations, interspersed with literal code fragments in the target programming language.
The template file is interpreted by the code generator and outputs .cpp, .java, .cs source code files, project files, or any other type of file depending on the template. The source code can then be compiled into an executable file that accesses XML data described by the schema file.
SPL files have access to a wide variety of information that is collated from the source schemas. Please note that an SPL file is not tied to a specific schema, but allows access to all schemas! Make sure you write your SPL files generically, avoid structures etc. which apply to specific schemas!
Example: Creating a new file in SPL:
This is a very basic SPL file. It creates a file named test.cpp, and places the include statement within it. The close command completes the template.
(C) 2018 Altova GmbH