
Generated C Function Format and Calling Parameters
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 global element defined in the specification will be written to xDec.c. In addition, the SAX handler functions that are invoked by the underlying XML parser software are written to a file with a name of the following format:
where <elemName> is the name of the XSD global element 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).
status = <decodeFunc> (OSCTXT* pctxt, <typeName>* pvalue);In this definition, <decodeFunc> is the name of the decode function described above and <typeName> is the name of the generated C type definition for the global element.
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 that 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 variable must be initialized using the rtSaxInitContext run-time function before use.
The pvalue argument is a pointer to a variable to hold the decoded result. This variable is of the type generated for the XSD type of the global element. The decode function will automatically allocate dynamic memory for variable length fields within the structure. This memory is tracked within the context structure and is released when the context structure is freed.
The function result variable status returns the status of the decode operation. Status code zero indicates the function was successful. A negative value indicates decoding failed. Return status values are defined in the "rtxErrCodes.h" include file. The reason text and a stack trace can be displayed using the rtxErrPrint function.
| Copyright © Objective Systems
2002-2005 This document may be distributed in any form, electronic or otherwise, provided that it is distributed in its entirety and that the copyright and this notice are included. |
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 |