This example shows how to handle XML vocabularies with multiple root elements using the element type and element map features of the C++/Tree mapping. The main purpose of element types is to distinguish object models with the same root type but with different root elements. The element map allows uniform parsing and serialization of multiple root elements. The example consists of the following files: protocol.xsd XML Schema which defines a simple bank account protocol with requests such as withdraw and deposit. Note that some request and response elements are of the same type. balance.xml withdraw.xml deposit.xml Sample XML instances for the protocol requests. protocol.hxx protocol.cxx C++ types that represent the given vocabulary. These are generated by the XSD compiler from protocol.xsd. Generation of element types instead of parsing and serialization functions is requested with the --generate-element-type option. Generation of the element map is requested with the --generate-element-map option. dom-parse.hxx dom-parse.cxx Definition and implementation of the parse() function that parses an XML document to a DOM document. dom-serialize.hxx dom-serialize.cxx Definition and implementation of the serialize() function that serializes a DOM document to XML. driver.cxx Driver for the example. It first calls the above-mentioned parse() function to parse the input file to a DOM document. It then calls the parse() function on the element map to parse the root document element to the object model. The object model is returned as a pointer to xml_schema::element_type which is a common base type for all element types. The driver then determines which request it has received either using RTTI or by comparing the root element names. Once the request type is determined, information about it is printed to STDERR and the corresponding response is created. Finally, the driver serializes the opaque response object to a DOM document using the element map and then serializes this DOM document to STDOUT using the above-mentioned serialize() function. To run the example on the sample XML request documents simply execute: $ ./driver balance.xml $ ./driver withdraw.xml $ ./driver deposit.xml