Generated Print Functions
The -print option causes print functions to be generated. These functions can be used to print the contents of variables of generated types.
where <xsdFileName> is the base name of the XSD file being parsed. For example, if code is being generated for file x.xsd and -print is specified, print functions will be written to xPrint.c. If the file being processed is a WSDL file, the suffix would be WSDLPrint.c (for example, x.wsdl would produce xWSDLPrint.c).
where <typeName> is the name of the XSD type for which the function is being generated and <ns> is an optional namespace setting that can be used to disambiguate names from multiple sources (note: this should not be confused with XML namespaces which are different). Note that print routines are generated for each type within a specification making it possible to print the contents of any typed variable (some generated functions are only generated for global elements).
<printFunc> (const char* name, <typeName>* pvalue)The name argument is used to hold the top-level name of the variable being printed. It is typically set to the same name as the pvalue argument in quotes (for example, to print an employee record, a call to `Print_PersonnelRecord ("employee", &employee) might be used).
The code snippet in the section entitled Procedure for Calling C Decode Functions contains an example of calling a generated print function. If a successful status is returned from calling the decode function, the contents of the decoded variable are printed:
stat = XmlD_personnelRecord (&ctxt, &employee); if (stat == 0) { if (trace) { printf ("Decode of PersonnelRecord was successful\n"); printf ("Decoded record:\n"); Print_PersonnelRecord ("employee", &employee); } }
Copyright © Objective Systems 2002-2008 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 RoadExton, 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 |