Generated C Function Format and Calling Parameters

Generated decode functions are written to a .c file with a name of the following format:

   <xsdFileName>Dec.c

where <xsdFileName> is the base name of the XSD file being parsed. For example, if code is being generated for file x.xsd, decode functions for each type and global element defined in the specification will be written to xDec.c.

The format of the name of each generated JSON type decode function is as follows:

   [<ns>]JsonDecT_<typeName>

where <typeName>is the name of the C type for which the function is being generated and <ns>is an optional namespace setting that can be used to disambiguate element names from multiple sources (note: this should not be confused with XML namespaces which are different).

The calling sequence for each decode function is as follows:

   status = <decodeFunc> (OSCTXT* pctxt, <name>* pvalue);

In this definition, <decodeFunc> denotes the decode function name defined above.

The pctxt argument is used to hold a context pointer to keep track of decode parameters. This is a basic "handle" variable that is used to make the function reentrant so it can be used in an asynchronous or threaded application. The user is required to supply a pointer to a variable of this type declared somewhere in his or her program.

The pvalue argument is a pointer to a variable to receive the decoded value. This variable is of the type generated from the XSD type.

The function result variable statusreturns the status of the encode operation. Status code 0 (zero) indicates the function was successful. A negative value indicates encoding failed. Return status values are defined in the rtxErrCodes.h include file. The error text and a stack trace can be displayed using the rtxErrPrint function.