Generated encode functions are written to a .c file with a name of the following format:
xsdFileName>Enc.c or <wsdlFileName>WSDLEnc.c
where <xsdFileName>is the base name of the XSD file being parsed; and <wsdlFileName> is the base name of the WSDL 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.wsdlwould produce xWSDLEnc.c).
The format of the name of each generated XML encode function is as follows:
<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
The calling sequence for each encode function is as follows:
status = <encodeFunc> (OSCTXT* pctxt, <name>[*] value, const OSUTF8CHAR* elemName, OSXMLNamespace* pNS);
In this definition, <encodeFunc> denotes the encode function name defined above.
pctxtargument 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.
valueargument 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 pvalueinstead of value). Check the generated function prototype in the
header file to determine how this argument is to be passed for a
The elemNameargument 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 pNSargument is used to specify namespace information. The structure contains a prefix and uri field. If prefix is set to NULL and uri is set to a string, the encoder will attempt to find the current prefix assigned to the URI by using internal namespace tables. If prefix is not null, the value in the structure is used without doing a URI lookup. If a null pointer is passed, no prefix is added to element name.
The function result variable
statreturns 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.hinclude file. The error text and a stack
trace can be displayed using the rtxErrPrintfunction.