6.20.3 Notes on schema generator
The following subsections give cautionary notes on schema generator.
Do not process the Java sources corresponding to the notes described in item no. 1 to item no. 32, 56, 57, 59 in the schema generator. For item no. 33 to item no. 55, and item no. 58, 60, 61 use the schema generator after considering the notes.
No. |
Notes |
---|---|
1 |
The scope for specification of JAXB mapping annotation has been restricted in the JAXB specifications. As described in the following example, an error might not occur when the JAXB mapping annotation is specified at a location that is outside the scope of specification described in the JAXB specifications, so take precautions. In such cases, the operations for executing JAXB are not defined. Example:
|
2 |
[Conditions] When any of the following combinations of JAXB mapping annotations are specified simultaneously:
Operations of Cosminexus XML Processor An error is output. No schema is generated. (Example)
|
3 |
[Conditions] When any one of the following is specified in a transient field
Operations of Cosminexus XML Processor Error occurs. (Example) Transient field "child" cannot have any JAXB annotations. |
4 |
[Conditions] When any one of the following is specified in a static field:
Operations of Cosminexus XML Processor No error occurs. |
5 |
[Conditions] When not even a single @XmlElement is specified in @XmlElements. Operations of Cosminexus XML Processor An invalid schema is output. |
6 |
[Conditions] When the @XmlJavaTypeAdapters annotation that does not contain even a single @XmlJavaTypeAdapter is specified. Operations of Cosminexus XML Processor A schema is output as if @XmlJavaTypeAdapters is not specified. |
7 |
[Conditions] When @XmlSeeAlso with an empty value element array is specified. Operations of Cosminexus XML Processor A schema such as when @XmlSeeAlso is not specified is output. |
8 |
[Conditions] When an empty character string is specified in the name element of any of @XmlElementWrapper, @XmlAttribute, @XmlElement, @XmlRootElement, or @XmlElementDecl. Operations of Cosminexus XML Processor
|
9 |
[Conditions] When all of the following conditions are applicable:
Operations of Cosminexus XML Processor No constraints are applicable to the type element of @XmlElement. The operations for the JAXB execution when such a Java source is used are not regulated. For details about the constraints, see the subsection 8.9.1.2 and Javadoc of JSR 222 The Java Architecture for XML Binding 2.1. |
10 |
[Conditions] When all of the following conditions are applicable:
Operations of Cosminexus XML Processor No error occurs. However, the processing will not be performed properly even when unmarshal is executed using the schema and java source. [Corrective action] If you want to specify multiple element definitions in a property or JavaBean field of collection type with parameters, use @XmlElementRefs and @XmlElementRef, and process them as collection type of JAXBElement. |
11 |
[Conditions] When an invalid value is specified for the type of a field or JavaBean property in which @XmlElement is specified in the defaultValue element of @XmlElement. Operations of Cosminexus XML Processor A schema document is generated for an element definition in which an invalid value is specified for the default attribute, and no error occurs. However, when you perform unmarshal with an Unmarshaller in which the generated schema is set up, an error indicating invalid schema (KECX06161-E) occurs. The generated schema will become invalid. |
12 |
[Conditions] When all of the following conditions are applicable:
Operations of Cosminexus XML Processor No error message is output and no schema can be generated. |
13 |
[Conditions] When all of the following conditions are applicable:
Operations of Cosminexus XML Processor The value of use attribute of a generated attribute definition is always required. |
14 |
[Conditions] When all of the following conditions are applicable:
Operations of Cosminexus XML Processor No error occurs, and a schema in which @XmlList is applied will be generated. |
15 |
[Conditions] When all of the following conditions are applicable:
Operations of Cosminexus XML Processor No error message is output and no schema can be generated. [Corrective action] Set up the name of the field or JavaBean specified in condition 2. to the same name as the element class name (however, name must be the converted name based on the rules for converting an XML name to Java name). (Example) @XmlRootElement @XmlType(name="") public class ItemType { public ItemType itemType;} |
16 |
[Conditions] When all of the following conditions are applicable:
Operations of Cosminexus XML Processor The abstract attribute cannot be added to the generated xs:complexType element. |
17 |
[Conditions] When @XmlEnum is specified in the enumeration type and the class that is not mapped in the simple type (example: java.lang.Object) is specified in the value element. Operations of Cosminexus XML Processor No error is output. The operations during the execution of JAXB when such a Java source is used are not regulated. |
18 |
[Conditions] When @XmlEnumValue is specified in the enumeration constant, and inappropriate words and phrases are specified for the @XmlEnum.value() type, in the value element. Operations of Cosminexus XML Processor No error is output. The operations during the execution of JAXB when such a Java source is used are not regulated. |
19 |
[Conditions] When all of the following conditions are applicable:
(Example) public class Root { // If the field name of condition 2. and 3. is childType, an element reference will be generated. protected ChildType child; } // Class specified in condition 1. @XmlRootElement @XmlType(name = "") public class ChildType { public String fname; } Operations of Cosminexus XML Processor An element definition (name attribute) will be generated. |
20 |
[Conditions] When all of the following conditions are applicable:
(Example) public class Root { @XmlElement(defaultValue="default") // Condition 4. protected ChildType childType; // Condition 2., 3. } // Class specified in condition 1. @XmlRootElement @XmlType(name = "") public class ChildType { public String fname; } Operations of Cosminexus XML Processor An element definition (name attribute) containing the default attribute is generated. |
21 |
[Conditions] When a JavaBean property is invalid because either of the setter method or getter method does not exist. Operations of Cosminexus XML Processor The schema is generated in such a way so that there is a correct JavaBean with both the setter and the getter method. An error does not occur. The operations during the execution of JAXB when such a Java source is used are not regulated. |
22 |
[Conditions] When specifications exists in an element of the JAXB mapping annotation, in such a way so that an invalid schema document is generated. (Example) @XmlRootElementpublic class ItemType { @XmlElement(name="A") public String item1; @XmlElement(name="A") public String item2; } The same element name ("A") is specified in different fields of @XmlElement(name="A"). Operations of Cosminexus XML Processor No error check is performed, and an invalid schema document is generated. |
23 |
[Conditions] When the character string "http://www.w3.org/2001/XMLSchema" that indicates a name space URI specific to the XML Schema specifications is specified in the namespace element of the JAXB mapping annotation. Operations of Cosminexus XML Processor No schema document containing such name space URI in the targetNamespace attribute is generated. There is no purpose or meaning in specifying the name space URI. |
24 |
[Conditions] When @XmlElements and @XmlMixed are specified simultaneously. Operation of Cosminexus XML Processor No error message is output and no schema can be generated. |
25 |
[Conditions] When all the following conditions are satisfied:
Operations of Cosminexus XML Processor No error message is output and no schema can be generated. |
26 |
[Conditions] When specifying the @XmlSchemaType annotation without the type element into a package. Operations of Cosminexus XML Processor An error does not occur. In the case of using such Java source, the operations for executing JAXB are not defined. |
27 |
[Conditions] When annotated with multiple @XmlID in a class. Operations of Cosminexus XML Processor An error does not occur, and a schema is generated. |
28 |
[Conditions] When any of the following conditions are satisfied:
Operations of Cosminexus XML Processor An error does not occur, and the schema is generated. |
29 |
[Conditions] When coding the following that is in contradiction to the "There is only one JavaBean property annotated by @XmlAnyElement in a class and its super class" restriction:
Operations of Cosminexus XML Processor No error is output. The operations during the execution of JAXB when such a Java source is used are not regulated. |
30 |
[Conditions] When @XmlAttachmentRef is added to the field or JavaBean property. Operations of Cosminexus XML Processor The value of the minOccurs attribute of the generated element definition will become 0. |
31 |
[Conditions] When the following java types are mapped in the schema document: char, Boolean, Character, Byte, Short, Integer, Long, Float, Double, byte[] Operations of Cosminexus XML Processor Mapping will be performed in the xs:unsignedShort, xs:boolean, xs:unsignedShort, xs:byte, xs:short, xs:int, xs:long, xs:float, xs:double, xs:base64Binary types respectively. |
32 |
[Conditions] When the @XmlJavaTypeAdapter annotation that does not contain the type element in the package statement, is specified. Operations of Cosminexus XML Processor No error occurs, and a schema in which the specification of @XmlJavaTypeAdapter is enabled will be generated. |
33 |
[Conditions] When @XmlAttribute is added to the static final field, or public static field. Operations of Cosminexus XML Processor The fixed attribute cannot be added to the generated xs:attribute element. |
34 |
[Conditions] When the @XmlElement annotation, in which the value of the required element is false, is specified in the field or JavaBean property of primitive type multi-dimensional array. Operations of Cosminexus XML Processor The value of the minOccurs attribute will become 0. |
35 |
[Conditions] When any one of @XmlList, @XmlJavaTypeAdapter, @XmlAttachmentRef, or @XmlMimeType is added to the parameters of the method. Operations of Cosminexus XML Processor The specification of these JAXB mapping annotations will be ignored. |
36 |
[Conditions] When the @XmlSchema annotation that does not contain the location element in the package, is specified. Operations of Cosminexus XML Processor The default value of the location element is interpreted as ##generate. |
37 |
[Conditions] When the @XmlType annotation is added to the enumeration type. Operations of Cosminexus XML Processor The final attribute cannot be added to the generated xs:simpleType. |
38 |
[Conditions] When all of the following conditions are applicable:
Operations of Cosminexus XML Processor The name space declarations specified in condition 1. and condition 2. are generated separately. There will be no problem even if the generated schema is used. |
39 |
[Conditions] When a class name or enumeration type name beginning with continuous upper-case characters exists. Operations of Cosminexus XML Processor The name obtained by converting the first continuous upper-case characters of the class name or enumeration type name to the lower-case characters is mapped to the XML name. |
40 |
[Conditions] When true is specified in the nillable element of @XmlElementWrapper. Operations of Cosminexus XML Processor minOccurs="0" is specified in the element definition of the generated schema. |
41 |
[Conditions] When any of the following conditions is applicable:
Operations of Cosminexus XML Processor The final attribute and block attribute cannot be added to the xs:element element. Also, the finalDefault attribute and block attribute cannot be added to the xs:schema element. |
42 |
[Conditions] When the @XmlValue annotation is added to the field or JavaBean property. Operations of Cosminexus XML Processor The final attribute cannot be added to the generated xs:simpleType element or xs:complexType element. |
43 |
[Conditions] When executing the csmschemagen command in a directory whose absolute path includes a hash mark (#). (Example) cd C:\jaxb\abc#xyz\test csmschemagen mypackage\TEST.java Operations of Cosminexus XML Processor The value of the schemaLocation attribute of the xs:import element of the generated schema document will become invalid. [Corrective action] Execute the csmschemagen command in a directory whose absolute path does not include a hash mark (#). |
44 |
[Conditions] When an output destination directory is not specified in an argument of the -d option in the csmschemagen command. Example: csmschemagen -d mypackage\TEST.java Operations of Cosminexus XML Processor The schema is not output. Moreover, an error might not be output. |
45 |
[Conditions] In the property and fields, if the values to be mapped with different formats are specified in type of @XmlElement and name of @XmlSchemaType. Operations of Cosminexus XML Processor A schema document of the element definition with the data type specified in name of @XmlSchemaType is generated. |
46 |
[Conditions] When all the following conditions are satisfied:
Operations of Cosminexus XML Processor The specified @XmlID or @XmlIDREF is not be applied in the generated global element definitions. |
47 |
[Conditions] When other than "" is specified in the substitutionHeadName element of @XmlElementDecl. Operations of Cosminexus XML Processor The substitutionGroup attribute of the xs:element element is not output. |
48 |
[Conditions] When a value other than \u0000 is specified in the defaultValue element of @XmlElementDecl. Operations of Cosminexus XML Processor The default attribute of the xs:element element is not be output. |
49 |
[Conditions] When all the following conditions are satisfied:
Operations of Cosminexus XML Processor A schema, with the attributes sorted in the alphabetical order, is generated. |
50 |
[Conditions] When specifying @XmlAccessorType and @XmlAccessorOrder in an internal class which is not of the top level class. Operations of Cosminexus XML Processor An error does not occur, and the annotation of the specification becomes valid. |
51 |
[Conditions] When you specify a Java source with an encoding different from the system encoding Operations of Cosminexus XML Processor No error message is output and an invalid schema might be generated. |
52 |
[Conditions] When all the following conditions are satisfied:
Operations of Cosminexus XML Processor The value of the minOccurs attribute is 0. |
53 |
[Conditions] When all the following conditions are satisfied:
Operations of Cosminexus XML Processor Error is not output and the schema is not generated. |
54 |
[Conditions] When any of the following conditions are satisfied:
Operations of Cosminexus XML Processor The command ends without outputting an error message. |