Introduction Supported XML Schema Built-in Datatypes Primitive Datatypes Derived Datatypes Supported XML Schema Structures Groups Wilcard
Introduction Castor XML supports the W3C XML Schema Recommendation document (05/02/2001). The Schema Object Model (located in the package org.exolab.castor.xml.schema) provides an in-memory representation of a given XML schema whereas the Source Generator provides a binding between XML schema datatypes and structures into the corresponding ones in Java. The Castor Schema Object Model can read (org.exolab.castor.xml.schema.reader) and write (org.exolab.castor.xml.schema.writer) an XML Schema as defined by the W3C recommandation. It allows to create and manipulate an in-memory view of an XML Schema. The Castor Schema Object Model supports the W3C XML Schema recommandation with no limitation. However the Source Generator does not offer currently a one to one mapping from an XML Schema component to a Java component for every XML Schema components: some limitations exist. The aim of the following sections is to provide a list of supported features in the Source Generator. Please keep in mind that the Castor Schema Object Model again can handle any XML Schema without limitations. It happens that a Schema type does not have the corresponding one in Java. Thus the Source Generator uses Castor implementation of these specific types (located in the types package). for instance the duration type is implemented directly in Castor. Remember that the representation of XML Schema datatypes does not try to fit exactly the W3C XML Schema specifications, the aim is to map an XML Schema type to the java type that fit the most to the XML Schema type. You will find next a list of the supported XML Schema datatypes and structures in the Source Code Generator. For a more detailed support of XML Schema structure and more information on the Schema Object Model, please refer to Source Generator User Document(PDF). Supported XML Schema Built-in Datatypes The following is a list of the supported datatypes with the corresponding facets and the java mapping type. Primitive Datatypes Type | Supported Facets | Java mapping type | string | length minLength maxLength pattern enumeration whiteSpace | java.lang.String | boolean | | primitive boolean type | decimal | totalDigits fractionDigits pattern whiteSpace enumeration maxInclusive maxExclusive minInclusive minExclusive | java.math.BigDecimal | float | pattern enumeration maxInclusive maxExclusive minInclusive minExclusive | primitive float type | double | pattern enumeration maxInclusive maxExclusive minInclusive minExclusive | double primitive type | duration | enumeration maxInclusive maxExclusive minInclusive minExclusive | org.exolab.castor.types.Duration | dateTime | enumeration | java.util.Date | time | enumeration maxInclusive maxExclusive minInclusive minExclusive | org.exolab.castor.types.Time | gYearMonth | enumeration maxInclusive maxExclusive minInclusive minExclusive | org.exolab.castor.types.GYearMonth | gYear | enumeration maxInclusive maxExclusive minInclusive minExclusive | org.exolab.castor.types.GYear | gMonthDay | enumeration maxInclusive maxExclusive minInclusive minExclusive | org.exolab.castor.types.GMonthDay | gDay | enumeration maxInclusive maxExclusive minInclusive minExclusive | org.exolab.castor.types.GDay | gMonth | enumeration maxInclusive maxExclusive minInclusive minExclusive | org.exolab.castor.types.GMonth | hexBinary | | primitive byte array | base64Binary | | primitive byte array | anyURI | enumeration | java.lang.String | QName | length minLength maxLength pattern enumeration | java.lang.String | Derived Datatypes Type | Supported Facets | Java mapping type | normalizedString | length minLength maxLength pattern enumeration | java.lang.String | NMTOKEN | enumeration | java.lang.String | NMTOKENS | | java.util.Vector of NMTOKEN | NCName | enumeration | java.lang.String | ID | enumeration | java.lang.String | IDREF | | java.lang.Object | IDREFS | | java.util.Vector of IDREF | integer | totalDigits fractionDigits pattern enumeration maxInclusive | primitive int type | nonPositiveInteger | pattern totalDigits fractionDigits maxInclusive maxExclusive minInclusive maxInclusive | primitive int type | NMTOKENS | | java.util.Vector of NMTOKEN | negativeInteger | pattern totalDigits fractionDigits maxInclusive maxExclusive minInclusive maxInclusive | primitive int type | long | pattern maxInclusive maxExclusive minInclusive minExclusive | primitive long type | int | pattern enumeration maxInclusive maxExclusive minInclusive minExclusive | primitive int type | short | pattern enumeration maxInclusive maxExclusive minInclusive minExclusive | primitive int type | byte | pattern enumeration maxInclusive maxExclusive minInclusive minExclusive | primitive byte type | nonNegativeInteger | pattern totalDigits fractionDigits maxInclusive maxExclusive minInclusive maxInclusive | primitive int type | positiveInteger | pattern totalDigits fractionDigits maxExclusive minExclusive maxInclusive minInclusive pattern | primitive int type | Supported XML Schema Structures Supporting XML schema structure is a constant work. The main structures are already supported with sometimes some limitations. The following will give you a rough list of the supported structures. For a more detailed support of XML Schema structure in the Source Generator or in the Schema Object Model, please refer to Source Generator User Document(PDF). Supported schema components: | - | Attribute Declaration (<attribute>) | - | Element Declaration (<element>) | - | ComplexType Definition (<complexType>) | - | AttributeGroup Definition (<attributeGroup>) | - | ModelGroup Definition (<group>) | - | ModelGroup (<all>, <choice>, <sequence>) | - | Annotation (<annotation>) | - | Wildcard (<any>) | - | SimpleType Definition (<simpleType>) | Groups Grouping support covers both Model Group Definitions (<group>) and Model Groups (<all>, <choice>, <sequence>). In this section, we will call 'nested group', a Model Group whose first parent is another Model Group. | - | For each top-level Model Group Definition, a class is generated either when using the 'element' mapping property or the 'type' one. | - | If a group - nested or not - appears to have maxOccurs > 1 then a class is generated to represent the items contained in the group. | - | For each nested group, a class is generated. The name of the generated class will follow this naming convention: Name,Compositor+,Counter? where | - | 'Name' is name of the top-level component (element, complexType or group). | - | 'Compositor' is the compositor of the nested group. For instance, if a 'choice' is nested inside a sequence, the value of Compositor will be SequenceChoice ('Sequence'+'Choice'). Note: if the 'choice' is inside a Model Group and that Model Group parent is a Model Group Definition or a complexType then the value of'Compositor' will be only 'Choice'. | - | 'Counter' is a number that prevents naming collision. | | Wilcard <any> is supported in the Source Generator and will map to an AnyNode. However full namespace validation is not yet implemented even though an AnyNode structure is fully namespace aware. <anyAttribute> is currently not supported, it is a work in progress |