Code Generation Tips
Resolving "Out of memory" exceptions during Java compilation
Complex schemas can produce a large amount of code, which might cause a java.lang.OutofMemory exception during compilation using Ant. To rectify this:
•Add the environment variable ANT_OPTS, which sets specific Ant options such as the memory to be allocated to the compiler, and set its value as shown below.
•To make sure that the compiler and the generated code run in the same process as Ant, change the fork attribute, in build.xml, to false.
You may need to customize the values depending on the amount of memory in your machine and the size of the project you are working with. For more details, see your Java VM documentation.
When running the ant jar command, you may get an error message similar to "[...] archive contains more than 65535 entities". To prevent this, it is recommended that you use Ant 1.9 or later, and, in the build.xml file, add zip64mode="as-needed" to the <jar> element.
Reserving method names
When customizing code generation using the supplied SPL files, it might be necessary to reserve names to avoid collisions with other symbols. To do this:
1.Navigate to the program installation directory, for example, C:\Program Files\Altova\XMLSpy2022.
2.In the spl subdirectory, locate the directory corresponding to the programming language, for example, ..\spl\java.
3.Open the settings.spl file and insert a new line into the "reserve" section, for example, reserve "myReservedWord".
4.Regenerate the program code.