Xmlbeansxx
Encyclopedia
xmlbeansxx is a C++-to-XML binding
XML data binding
XML data binding refers to a means of representing information in an XML document as an object in computer memory. This allows applications to access the data in the XML from the object rather than using the DOM or SAX to retrieve the data from a direct representation of the XML itself.An XML data...

 framework
Software framework
In computer programming, a software framework is an abstraction in which software providing generic functionality can be selectively changed by user code, thus providing application specific software...

 which is software based on Apache License
Apache License
The Apache License is a copyfree free software license authored by the Apache Software Foundation . The Apache License requires preservation of the copyright notice and disclaimer....

 2.0 Open Source license.

Description

xmlbeansxx is a tool that allows access to XML
XML
Extensible Markup Language is a set of rules for encoding documents in machine-readable form. It is defined in the XML 1.0 Specification produced by the W3C, and several other related specifications, all gratis open standards....

 in a C++ friendly way. It is similar and in fact inspired by Apache XMLBeans
XMLBeans
XMLBeans is a Java-to-XML binding framework which is part of the Apache Software Foundation XML project.-Description:XMLBeans is a tool that allows access to the full power of XML in a Java friendly way...

 project. Similarly to XMLBeans, xmlbeansxx provide an XML Schema 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
XMLBeans
XMLBeans is a Java-to-XML binding framework which is part of the Apache Software Foundation XML project.-Description:XMLBeans is a tool that allows access to the full power of XML in a Java friendly way...

 distribution package, a following code handles printing of items from easypo.xml file:

  1. include "EasyPO.h"
  2. include
  3. include


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 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: "< }
return 0;
}

History

xmlbeansxx project begun in 2004 as an effort to implement a part of Apache XMLBeans
XMLBeans
XMLBeans is a Java-to-XML binding framework which is part of the Apache Software Foundation XML project.-Description:XMLBeans is a tool that allows access to the full power of XML in a Java friendly way...

 in C++. The project goal was to create an XML binding tool, based on Open Source license, for use in commercial projects. In fact, it's been successfully used at TouK in a few commercial projects. xmlbeansxx evolved over the years to fulfill ongoing requirements, so it changed a lot from initial version.

The project was submitted to The Apache Incubator
Apache Incubator
Apache Incubator is the gateway for Open source projects intended to become fully fledged Apache Software Foundation projects.The Incubator project was created in October 2002 to provide an entry path to the Apache Software Foundation for projects and codebases wishing to become part of the...

 in 2005, under a name xmlbeanscxx. However it didn't obtain much development effort. This was mainly because one of the supporting companies decided to change their objectives and quit. Although, the project is still in development at TouK company, the initial contributor.

Supported Compilers

Initially xmlbeansxx was supported on GNU Compiler Collection
GNU Compiler Collection
The GNU Compiler Collection is a compiler system produced by the GNU Project supporting various programming languages. GCC is a key component of the GNU toolchain...

. However the recent version 0.9.1 supports also Microsoft Visual Studio
Microsoft Visual Studio
Microsoft Visual Studio is an integrated development environment from Microsoft. It is used to develop console and graphical user interface applications along with Windows Forms applications, web sites, web applications, and web services in both native code together with managed code for all...

 compiler. This was done using CMake
CMake
CMake is a cross-platform, open-source system for managing the build process of software using a compiler-independent method. It is designed to support directory hierarchies and applications that depend on multiple libraries, and for use in conjunction with native build environments such as Make,...

multiplatform build tool.

External links


The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK