TOC PREV NEXT INDEX


Generated C Function Format and Calling Parameters


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

<xsdFileName>Enc.c

where <xsdFileName> is the base name of the XSD file being parsed. For example, if code is being generated for file x.xsd, encode functions for each type and global element defined in the specification will be written to xEnc.c. If the file being processed is a WSDL file, the suffix would be WSDLEnc.c (for example, x.wsdl would produce xWSDLEnc.c).
The format of the name of each generated XML encode function is as follows:

    [<ns>]XmlET_<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 encode function is as follows:

    status = <encodeFunc> 
       (OSCTXT* pctxt, <name>[*] value, const OSUTF8CHAR* elemName, 
        const OSUTF8CHAR* nsPrefix);

In this definition, <encodeFunc> denotes the encode function name defined above.
The pctxt argument is used to hold a context pointer to keep track of encode 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 value argument contains the value to be encoded or holds a pointer to the value to be encoded. This variable is of the type generated from the XSD type. The object is passed by value if it is an atomic XSD simple type such as boolean, integer, etc.. It is passed using a pointer reference if it is a structured type value (in this case, the name will be pvalue instead of value). Check the generated function prototype in the header file to determine how this argument is to be passed for a given function.
The elemName argument is used to pass an XML element name for the type. This name is what is included in the <name> </name> brackets used to delimit an XML item. If a null pointer (0) is passed in for this argument, then no name wrapper is added to encoded XML item.
The nsPrefix argument is used to specify a namespace prefix. If this value is null or empry, no prefix is added to element name. If a prefix is given, a qualified element name of the form nsPrefix:elemName is generated.
The function result variable stat returns 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.

Copyright © Objective Systems 2002-2007
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.

55 Dowlin Forge Road
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