Tuesday, September 1, 2009

Getting Started with Axiom/CPP

WSF/CPP comes with its own XML processing model which is Axiom. If you are already familiar with either Axiom/Java or Axiom/C it would not be difficult to grasp how to use Axiom/CPP.

Lets have a look at an small example. Say we want to construct an XML as follows.

<WSO2 xmlns:ns1="http://wso2.org">








Lets construct this xml using Axiom/CPP.

First call the Environment::initialize() method to initialize WSF/CPP.


Now create OMElement in the corresponding order. You can pass the parent element to the constructor of the child element. The code is self explanatory.

int main()



   OMElement *wso2 = new OMElement(NULL,"WSO2", new OMNamespace("http://wso2.org","ns1"));
    OMElement *projects = new OMElement(wso2, "projects");;
    OMElement *wsf = new OMElement(projects,"WSF");
    OMElement *wsfcpp = new OMElement(wsf, "WSFCPP");
    OMElement *wsfphp = new OMElement(wsf, "WSFPHP");

    delete wso2;

   return 0;


No comments:

Post a Comment