To use you own XML Schema, you will basically do the same things you saw in the PurchaseOrder sample. Keep in mind the following:
For every global element, an *_CC class is created. This will provide you with encodeDocument, decodeDocument methods.
Using the _CC classes is not required. They are fairly simple and you could use them as a basis for creating something else that meets your particular needs.
The XBXmlEncoder class encodes to an underlying stream. You control where the data goes by configuring the stream you provide.
Under Java, decoding requires StAX. See the section on Building and Running Generated Code for information about StAX.