Global Element Base Class

The global element base class - OSXSDGlobalElement - is the base class from which generated XSD global element control classes are derived. These are the main entry points for encoding or decoding items within an XML schema specification. The control class derived from this class is typically constructed with a reference to a variable of the type to be encoded or decoded as well as the associated message buffer. For example, from the C++ employee sample program writer program is the following snippet of code:

      PersonnelRecord value;
      OSXMLEncodeBuffer buffer;
      personnelRecord_CC pdu (buffer, value);

These three lines of code form the necessary associations to accomplish the encoding of an employee record. The global element declaration in the employee.xsd file is the following:

      <xsd:element name="personnelRecord" type="PersonnelRecord"/>

This declares the personnelRecord element to be of type PersonnelRecord. The XBinder compiler generates the PersonnelRecord C++ class for the PersonnelRecord XSD type. It also generates the personnelRecord_CC class for the personnelRecord XSD global element (the _CC suffix is an abbreviation for “control class”). The series of statements above bind an instance of this generated type class with an encode message buffer to accomplish the encoding of an instance of the personnelRecord global element.