
Getting Started with your own XML Schema
The quickest way to get up and running with your own XML schema file or set of files is to let XBinder generate a sample program for you. This is done using the -genwriter and/or -genreader command-line options. These options cause a complete writer and/or reader program to be generated and, when used in combination with -genmake, cause a makefile to be generated to build the entire project.
For example, suppose you had a schema file named mySchema.xsd that you wanted to generate encoders and decoders for. The following command could be used to generate a complete set of C source files for this schema (note: C++ source files could be generated simply by changing -c to -c++ in this command):
xbinder mySchema.xsd -c -xml -print -genwriter -genreader -genmakeAfter generation is complete, all that needs to be done is execution of the generated makefile with the make utility program and all of the files will be compiled and linked to form reader and writer executable files. Note that if this is being done on Windows, the -w32 option should be added to generate a makefile that is compatible with the Visual C++ nmake utility.
The generated files can now act as a template on which you can base your own development. The generated mySchemaTest.c (or .cpp) file contains the complete logic necessary to populate a data record corresponding to your schema. The file in this case contains random data. This code generation can be taken a step further if you have a sample of an XML instance that matches you schema (say, for example, mySchemaInstance.xml). In this case, you can add -gentest mySchemaInstance.xml to the command line and test source code will be generated that populates a structure with data from the test instance.
| 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 |