Using Code Generated from XML Schemas
Obviously once you get code generated by XBinder, you'll want to make use of it. The most common operations that involve the use of XBinder-generated code are decoding and encoding.
There is a -genreader qualifier on the XBinder command that will generate a reader program designed to decode an XML instance (stored in a file) that conforms to the schema you're compiling. There is also a -genwriter qualifier that will generate a writer program designed to encode an XML instance (to a file) that conforms to the schema you're compiling. In most cases the generated files can be used as a starting point and adapted for your purposes. Their names are reader.<x> and writer.<x>, where <x> is c, cpp, java, or cs, depending on your chosen language.
It's also worth pointing out that there are numerous samples included with the XBinder software. Under the main XBinder install directory are directories for each possible generated language. These directories are called "c", "cpp", "java", and "csharp". And under each of these directories is a "sample" directory that contains numerous examples showing ways in which XBinder can be used, some of which this tutorial doesn't cover. For example, in the "c/sample" directory, there is a sample that shows how XBinder can be used to process XML data that contains employee information. There is also a sample that shows how a calculator web service that's described using WSDL could be generated with XBinder.
Let's look more closely at how you would use code generated in each of the languages. For all of these examples we'll assume that the instance to decode is contained in a file and the encoding is to write the created instance to a file. There is some flexibility here in that any input or output mechanism that can have a stream associated with it can be used, but for our examples we'll use files.