Altova MapForce 2025 Enterprise Edition

Code Generator

Home Prev Top Next

Code Generator is a MapForce built-in feature which enables you to generate code from mapping files. The result is a fully-featured and complete application which performs the mapping operation for you. After you have generated the code, you can execute the mapping by running the application directly as generated. You can also import the generated code into your own application and extend the code with your own functionality.

 

Support information

The table below summarizes support information about C++, C#, and Java.

 

Target Language

C++

C#

Java

Development environments

Microsoft Visual Studio 2013, 2015, 2017, 2019, 2022

Microsoft Visual Studio 2013, 2015, 2017, 2019, 2022

 

Target frameworks:

 

.NET Framework

.NET Core 3.1

.NET 5.0

.NET 6.0

.NET 8.0

Java SE JDK 8, 11, 17, 21 (including OpenJDK)

Eclipse 4.4 or later

Apache Ant (build.xml file)

XML DOM implementations

MSXML 6.0

Apache Xerces 3

System.Xml

JAXP

Database API

ADO

ADO.NET

JDBC

 

Note:The MapForce-generated code can be considered thread-safe only if the underlying third-party XML DOM and database API libraries are. Although the thread safety of the generated code cannot be realistically proven or guaranteed, it is likely that multiple concurrent instances of the mapping code will run successfully in most cases.

 

C++

You can configure whether the C++ generated output should use MSXML 6.0 or Apache Xerces 3. MapForce generates complete project (.vcproj) and solution (.sln) files for all supported versions of Visual Studio (see table above). The generated code optionally supports MFC.

 

Note the following prerequisites:

 

To compile the generated C++ code, Windows SDK must be installed on your computer.

To use Xerces 3 for C++, you will need to install and build it using the instructions on the Apache Xerces page. Make sure to add the XERCES3 environment variable that points to the directory where Xerces is installed (e.g., C:\xerces-c-3.2.2). Also, the PATH environment variable must include the path where the Xerces binaries are (e.g., %XERCES3%\bin).

When you build C++ code for Visual Studio and use a Xerces library precompiled for Visual C++, you will need to change the compiler setting in all the projects of the solution. Follow the steps below:

 

a)Select all projects in the Solution Explorer.

b)Click Properties in the Project menu.

c)Click Configuration Properties | C/C++ | Language.

d)In the list of configurations, select All Configurations.

e)Change Treat wchar_t as Built-in Type to No (/Zc:wchar_t-).

 

C#

The generated C# code can be used from any .NET capable programming language, such as VB.NET, Managed C++, or J#. Project files can be generated for all supported versions of Visual Studio (see table above).

 

Java

The generated Java output is written against the Java API for XML Processing (JAXP) and includes an Ant build file and project files for supported versions of Java and Eclipse (see table above).

 

Generate, build, run, integrate code

For instructions on how to generate, build, and run code, see Generate, Build, and Run Code. For details about integrating MapForce-generated code into your custom code, see Integrate Generated Code.

 

Code-generation templates

The generated code is built via a template that is written in a template language called SPL (Spy Programming Language). You can customize the template used for code-generation. This can be useful, for example, when you want to customize your code in accordance with your company's writing conventions or replace specific libraries in the generated code.

 

Examples

For examples illustrating code generation capabilities, see Example: Book Library and Example: Purchase Order.

 

© 2018-2024 Altova GmbH