XML to C++ the easy way

Codalogic XML C++ Binding Uses

Do you want to...

  • ...read and write XML data using C++?
  • ...speed up code development?
  • ...reduce the risk of bugs in your code?

Read and write XML data like:

    <Name>Codalogic LMX</Name>

using C++ code like:

    std::cout << myObject.GetName() << ": " <<
                 myObject.GetQuantity() << "\n";


    myObject.SetQuantity( 1 );
    myObject.SetName( L"Codalogic LMX" );

Codalogic LMX is a code generator that generates custom C++ classes that mirror the structure of your XML data.

This approach speeds up code development by enabling IDE code completion and reduces potential bugs by checking XML attribute and element names and types at compile time.

In short, Codalogic LMX allows you to ship a better product, sooner.

Codalogic LMX generates custom C++ classes that mirror the structure of your XML data.

It also generates code to write the contents of the C++ classes to XML and create instances of the C++ classes from XML. When reading XML data into the C++ classes, the generated code will validate and verify that the XML is of the correct form and will return an error if not.

You can describe the structure of your XML using an example of your XML data, W3C XSD XML schema or an XML DTD.

"Easily the best (most accurate) XML data binding of the tools I've used. And they have the best support I've received from ANY vendor for any tool. Would highly recommend to anybody that needs this ability." - Nick Godbey, SITA.

The generated databinding code runs on any C++03 or later compliant C++ compiler and includes conditional compilation support for C++11 features such as move and range-based for. The generated code and the supporting runtime software (such as the XML parser) are provided in source code form so you can compile it on any compliant compiler you wish, with any set of compilation options you wish.

The generated code is extensively tested on numerous versions of Visual Studio and g++ as well as compilers from IBM and HP. There are no dependencies on third-party software beyond the C++ STL and all the code can be distributed as a compiled part of your application royalty-free.

The code generator itself runs on Windows and Linux. Both platforms have command-line and GUI versions.

WinLMX GUI Interface for XML C++ data binding

The Windows® Interface Version of LMX - WinLMX

A key strength of Codalogic LMX is the flexibility with which it allows you to customize its behavior to your liking.

For example, you can easily select whether you want to store strings in the generated C++ classes as std::string, std::wstring or even your own string class. If you decide you don't want to use our classes for things like dates and binary data you can easily modify the user configurable typedefs to use your preferred classes.

You can even designate specific XML data values to be represented using your custom C++ classes using Codalogic LMX's micro-formats feature. And you can instruct Codalogic LMX to convert the generated variable and type names to CamelCase or snake_case.

An even more powerful customization feature is Codalogic LMX's snippet event handlers. These allow you to hook your own code into the various marshalling (C++ to XML) and unmarshalling (XML to C++) stages. Many of our customers have found this feature useful, such as for adding extra input data validation.

The Codalogic LMX Workflow
Click on the image to walk through the Codalogic LMX XML to C++ workflow

Codalogic LMX enables you to create your application faster in a number of ways.

The code to check that your XML data is in the right format is generated automatically, saving you days and weeks of writing tedious and error prone data verification code. Resource management (such as memory) is handled by the generated code so you don't have to worry about accidental C++ memory leaks.

In addition to extensive documentation being included in the generated header files and an HTML file, your development environment can understand the generated C++ code allowing you to write code faster and more accurately using code completion.

And because you access the data using custom named functions that can be checked by the compiler at compile time rather than unchecked string parameters to a function, you potentially spend less time chasing bugs caused by typos in element and attribute names.

All these benefits allow you to create your application sooner enabling you to get revenue sooner and get real end-customer input on earlier iterations, and/or reassign developer resources to add extra customer pleasing features rather than doing low-level, low-ROI coding.

It's for these reasons and more that Codalogic LMX is used by many customers, both large and small. Some of the bigger customers include Boeing, Lockheed Martin, General Dynamics, BAE Systems, Northrop Grumman, Rolls Royce, and Samsung,

To explore Codalogic LMX further we suggest downloading the evaluation version. If you include your email address (you don't have to) we can send you a 30-day trial license that enables full functionality and some suggestions on how to start your evaluation.

Or you can download an already worked example, try LMX online, or look at the documentation.

And feel free to with any questions you might have. We'd love to hear from you.

What do you want to do now?

You can:

Providing exceptional support is very important to us. If you have questions about Codalogic LMX XML C++ Databinder, please send a message to .

Note that you can also access these pages using the convenience URL http://www.xml2cpp.com.

Copyright © 2003-2021, Codalogic Ltd. All Rights Reserved.