xmlbeansxx

From Wikipedia, the free encyclopedia

This is an old revision of this page, as edited by BG19bot (talk | contribs) at 06:37, 14 May 2016 (→‎External links: Remove blank line(s) between list items per WP:LISTGAP to fix an accessibility issue for users of screen readers. Do WP:GENFIXES and cleanup if needed. Discuss this at... using AWB). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

xmlbeansxx
Developer(s)TouK
Stable release
0.9.1 / April 1, 2008 (2008-04-01)
Repository
Operating systemCross-platform
TypeXML binding
LicenseApache 2.0
Websitegithub.com/TouK github sourceforge

xmlbeansxx is a software framework for C++ to XML binding. It is open-source software licensed under Apache License 2.0.

Description

xmlbeansxx is a tool allowing access to XML in a C++ friendly way. It is similar to, and inspired by, the Apache XMLBeans project. Similarly to XMLBeans, xmlbeansxx provide an XML Schema Definition (XSD) instance to C++ code generator. The generated code can be later invoked to access XML instance document data.

Example

Given an example of a simple XML Schema Definition describing a purchase order, as shown in examples from Apache XMLBeans distribution package, the following code handles printing of items from easypo.xml file:

#include "EasyPO.h"
#include <iostream>
#include <fstream>

using namespace std;
using namespace xmlbeansxx;
using namespace xmlbeansxx::samples::enumeration::schemaenum::easypo;

int main() {

    try {
        fstream in("easypo.xml", ios::in);
        PurchaseOrderDocument poDoc=PurchaseOrderDocument::Factory::parse(in);

        LineItem giftLineItem = poDoc.getPurchaseOrder().addNewLineItem();
        giftLineItem.setDescription(string("Calendar"));
        giftLineItem.setPrice(3);
        giftLineItem.setQuantity(6);
        giftLineItem.setPerUnitOunces(10);

        vector<LineItem> arr = poDoc.getPurchaseOrder().getLineItemArray();
        for(unsigned i=0; i < arr.size() ; i++) {
            cout << "item: " << i << "\n";
            cout << " - description:     " << arr[i].getDescription() << "\n";
            cout << " - quantity:        " << arr[i].getQuantity() << "\n";
            cout << " - price:           " << arr[i].getPrice() << "\n";
            cout << " - amount:          " << arr[i].getQuantity() * arr[i].getPrice() << "\n";
        }

        cout << "Xml:\n" << poDoc.toString() << "\n";

    } catch (BeansException &ex) {
        cout<<"BeansException: "<<ex.getMessage()<<"\n";
    }
    return 0;
}

History

The xmlbeansxx project begun in 2004 as an effort to implement a part of Apache XMLBeans in C++. The project goal was to create an XML binding tool, based on an open source license, for use in commercial projects. It has been used successfully at TouK company in a few commercial projects. xmlbeansxx evolved over the years to fulfill ongoing requirements, so it changed a lot from the initial version.

The project, named xmlbeanscxx, was submitted to The Apache Incubator in 2005. However it didn't receive much development effort, mainly because one of the supporting companies decided to change their objectives and quit. The project is still in development at TouK company, the initial contributor.

Supported compilers

Initially xmlbeansxx was supported on the GNU Compiler Collection. As of 2008, version 0.9.1 also supported Microsoft Visual Studio compiler. This was done using CMake multiplatform build tool.

See also

External links