For each global element, a document control class is generated. These are named <elem name>_CC.
The document class contains a value that represents the global element, along with encodeDocument and decodeDocument methods.
Here is an abbreviated example:
Java:
public class MyDoubleElement_CC implements XBDocumentCodec { private XBContext _xbContext = new XBContext(); ... public double getValue() {...} public void setValue(double value) {...} public void decodeDocument(XMLStreamReader reader) {...} public void encodeDocument(XBXmlEncoder encoder) {...} ... }
C#:
public class MyDoubleElement_CC : XBDocumentCodec { private XBContext _xbContext = new XBContext(); ... public double getValue() {...} public void setValue(double value) {...} public void decodeDocument(XMLStreamReader reader) {...} public void encodeDocument(XBXmlEncoder encoder) {...} ... }
To use the namespace prefixes generated for your schema, do the following before calling encodeDocument (or, create and pass your own array):
encoder.setNamespaces(_myschema.namespaceContext);
Features to note are:
get/set methods for the element's value. In this example, the element was of simple type double.
The _xbContext field is used during encoding/decoding; you don't need to create an XBContext object when you use the decodeDocument or encodeDocument methods.