Schema Classes

For each schema being compiled, a schema class is generated. It will be named _<schema>, where <schema> comes from the .xsd file name.

Here is an abbreviated example:

Java:

   public class _myschema {
      public static XBXmlNamespace[] namespaceContext = {
         new XBXmlNamespace("", "http://obj-sys.com/example")};

      //declare constants for the schema's ns and preferred prefix
      public static final String NS_URI = "http://obj-sys.com/example";
      public static final String NS_PREFIX = "osys";

      public static XBDoubleFormat defaultDoubleFmt = new XBDoubleFormat();
      public static XBDoubleFormat globalFloatNumFmt = new XBDoubleFormat(...);
      public static XBDoubleFormat numFmt0 = new XBDoubleFormat(...);

      public _myschema() {
      }
   }

C#:

   public class _myschema {
      public static XBXmlNamespace[] namespaceContext = {
         new XBXmlNamespace("", "http://obj-sys.com/example")};

      //declare constants for the schema's ns and preferred prefix
      public static readonly String NS_URI = "http://obj-sys.com/example";
      public static readonly String NS_PREFIX = "osys";

      public static XBDoubleFormat defaultDoubleFmt = new XBDoubleFormat();
      public static XBDoubleFormat globalFloatNumFmt = new XBDoubleFormat(...);
      public static XBDoubleFormat numFmt0 = new XBDoubleFormat(...);

      public _myschema() {
      }
   }

This schema class demonstrates the following features:

  1. namespaceContext: represents prefix-namespace mappings you might want to initialize the encoder with. These are derived from the compiled schema.

  2. NS_URI, NS_PREFIX: referenced in generated code when encoding elements from this schema

  3. *Fmt* fields: referenced in generated code for formatting numeric values during encoding. These are the result of specifying format options in the configuration file.