TOC PREV NEXT INDEX


C Code Generated for XSD Types


If C code generation is selected, the following items are generated for each XSD type:

A sample section from a C header file is as follows:

/**************************************************************/
 
/*                                                            */
 
/*  Name                                                      */
 
/*                                                            */
 
/**************************************************************/
 

 
typedef struct EXTERN Name {
 
   OSXMLSTRING givenName;
 
   OSXMLSTRING initial;
 
   OSXMLSTRING familyName;
 
} Name;
 

 
EXTERN int XmlET_Name
 
  (OSCTXT* pctxt, Name* pvalue,
 
   const OSUTF8CHAR* elemName, const OSUTF8CHAR* nsPrefix);
 

 
EXTERN int Init_Name (OSCTXT* pctxt, Name* pvalue);
 

 
EXTERN void Print_Name
 
   (const char* name, Name* pvalue);
 

This corresponds to the following XSD type definition:

   <xsd:complexType name="Name">
 
      <xsd:sequence>
 
         <xsd:element name="givenName" type="xsd:string"/>
 
         <xsd:element name="initial" type="xsd:string"/>
 
         <xsd:element name="familyName" type="xsd:string"/>
 
      </xsd:sequence>
 
   </xsd:complexType>
 

 
In this case, the Name C struct typedef corresponds to the Name XSD complex type definition.
The XmlET_Name function prototype is the XML encode function for the type. The type has no decode function because decoding is handled by SAX handler functions.
The Init_Name function prototype is the declaration of the type's initialization function. This function is called to initialize a variable of the type before encoding or decoding. It initializes all fields to zero or to the field's fixed or default value as specified in the XSD source file.
The Print_Name function prototype is for a print utility function. This is an optional function that was generated by using the -print command line qualifier. It prints the contents of a variable of the generated type to the standard output device.

Objective Systems, Inc.

102 Pickering Way, Suite #506
Exton, Pennsylvania 19341
http://www.obj-sys.com
Phone: (484) 875-9841
Toll-free: (877) 307-6855 (US only)
Fax: (484) 875-9830
info@obj-sys.com
TOC PREV NEXT INDEX