Please enable JavaScript to view this site.

Altova XMLSpy 2020 Enterprise Edition

Code Generator

Introduction to code generator

Scroll Home Prev Top Next More

The generated code supports the following operations:


Read XML files into a Document Object Model (DOM) in-memory representation

Write XML files from a DOM representation back to a system file

Convert strings to XML DOM trees and vice versa.


The generated code is expressed in C++, Java or C# programming languages.


Target Language




Development environments

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

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

Java SE JDK 7, 8, or 11 (including OpenJDK)

Eclipse 4.4 or later

Apache Ant (build.xml file)

XML DOM implementations


Apache Xerces 3





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




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

2.To use Xerces 3 for C++, you will need to install and build it by following instructions from Make sure to add the XERCES3 environment variable that points to the directory where Xerces was installed, for example: C:\xerces-c-3.2.2. Also, the PATH environment variable must include the path where the Xerces binaries are, for example: %XERCES3%\bin.

3.When building C++ code for Visual Studio and using a Xerces library precompiled for Visual C++, a compiler setting has to be changed in all projects of the solution:


a)Select all projects in the Solution Explorer.

b)On the Project menu, click Properties.

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-).



The generated C# code uses the .NET XML classes (System.Xml) and 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).



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).


Generated output

The designated destination folder for the generated code includes all the libraries and files required to manipulate XML files programmatically, namely:


Standard Altova libraries

Schema wrapper libraries

An empty test application with sample source code. The test application skeleton is a compilable application that calls an empty Example() method. You can add your test code into this method for easy and quick testing of your new generated library.


Code generator templates

Output code is completely customizable via a simple yet powerful template language (SPL, from Spy Programming Language) which gives full control in mapping XML Schema built-in data-types to the primitive datatypes of a particular programming language. SPL allows you to easily replace the underlying parsing and validating engine, customize code according to your company's writing conventions, or use different base libraries such as the Microsoft Foundation Classes (MFC) and the Standard Template Library (STL).


With SPL, you can build your own templates to automate the generation of virtually any other format, for example: EJB's, WSDL files, SQL scripts, ASP or WML code.


XMLSpy's schema editor is well suited as a software modeling and prototyping tool, allowing XML applications to be rapidly prototyped at a high level in XML Schema and then automatically generated. Changes to an application's XML Schema content model can be immediately reconciled with a software implementation simply by re-running the code generator.

© 2020 Altova GmbH