Hitachi

uCosminexus Application Server XML Processor User Guide


6.20.2 Notes on schema compiler

The following subsections give cautionary notes on schema compiler.

Do not process the schema corresponding to the notes described in item no. 1 to item no. 28 by the schema compiler. For item no. 29 to item no. 44, use the schema compiler after considering the notes.

Table 6‒44: Notes on JAXB (schema compiler)

No.

Notes

1

[Conditions]

When all of the following conditions are applicable to contents model with iterative specifications:

  • An element definition in which nillable="true" is specified exists.

  • The contents model is not mixed and does not include a wildcard.

  • The element definition of the contents model does not include an xml data type of xs:list and xs:IDREF, or a data type derived from xs:list and xs:IDREF.

  • Two different element definitions bound to the same Java data type do not exist for all element definitions of the contents model.

(Example)

<xs:complexType>

<xs:sequence maxOccurs="unbounded">

<xs:element name="A" type="xs:string" />

<xs:element name="B" type="xs:int" nillable="true" />

<xs:element name="C" type="xs:float" nillable="true"/>

<xs:element name="D" type="xs:double" />

</xs:sequence>

</xs:complexType>

Operation of Cosminexus XML Processor

A collection is optimized. The collection annotated with @XmlElements/@XmlElement instead of @XmlElementRefs/@XmlElementRef is output. An invalid operation might be performed when unmarshal and marshal is executed using the java source that is output.

2

[Conditions]

When all of the following conditions are applicable:

  1. A reserved device name of Windows, such as www.com1.hitachi is included in the targetNamespace attribute of the xs:schema element.

  2. The schema compiler is executed on Windows.

Operations of Cosminexus XML Processor

Error occurs.

(Example)

[ERROR] .\hitachi\com1\ObjectFactory.java (The specified path is not found. [errno=3, syscall=CreateFileW])

3

[Conditions]

When all of the following conditions are applicable to the first character of the character string that separates the URI specified in the targetNamespace attribute of the xs:schema element by a colon (:) or forward slash (/):

  • The return value of Character.isJavaIdentifierStart becomes false.

  • The return value of Character.isJavaIdentifierPart becomes false.

Operations of Cosminexus XML Processor

An error indicating an invalid package name occurs.

(Example)

[ERROR] The package name 'publicid.__-.w3c.dtd_html_4_01.en' used for this schema is not a valid package name.

4

[Conditions]

When the URI specified in the targetNamespace attribute and xmlns attribute of the xs:schema element is configured only from the following characters:

  • Periods (.)

  • Forward slashes (/)

  • Character string "www"

Operations of Cosminexus XML Processor

Exceptions that are not provided such as java.lang.ArrayIndexOutOfBoundsException might occur.

5

[Conditions]

When any of the following conditions are satisfied:

  • When multiple xs:any elements exist in the contents model without iterative specification.

  • Using the complex type extension, both the base type and extension type include the xs:any type as the element contents.

Operations of Cosminexus XML Processor

An error occurs by trying to generate multiple properties and not a single general contents property. For details about the general contents properties, see the subsection 6.12.3 of JSR 222 The Java Architecture for XML Binding 2.1.

(Example)

[ERROR] Property "Any" is already defined. Use &lt;jaxb:property> to resolve this conflict.

Note that if you specify jaxb:property custom binding and execute unmarshalling or marshalling using the java source with multiple @XmlAnyElement annotated properties that are output, some invalid operations might be performed.

6

[Conditions]

When any of the following conditions are satisfied:

  • When the format is derived, true is specified for the value of the mixed attribute in a complexType element having the derived type.

  • When the format is derived, true is specified for the value of the mixed attribute having the base type.

Operations of Cosminexus XML Processor

The method for acquiring a child element of the derived format will not be generated.

7

[Conditions]

When all of the following conditions are applicable:

  1. The jaxb:typesafeEnumClass custom binding that has jaxb:typesafeEnumMember as a child element for the xs:simpleType element. Also, the name attribute is specified in jaxb:typesafeEnumMember.

  2. The jaxb:typesafeEnumMember custom binding is specified for the xs:enumeration element that is a lower element of xs:simpleType specified in condition 1, and the name attribute is also specified.

  3. The attribute values of the name attribute specified in condition 1. and 2. differ.

Operations of Cosminexus XML Processor

The enumeration constant name of the Java class is generated based on the name attribute specified in condition 1.

8

[Conditions]

When custom binding is specified in any of the following XML schema elements:

  • jaxb:typesafeEnumClass is specified in the xs:attributeGroup element.

  • jaxb:typesafeEnumClass is specified in the xs:extension element that is the child element of the xs:complexContent element.

  • jaxb:typesafeEnumClass/jaxb:typesafeEnumMember/jaxb:property is specified in the xs:restriction element that is the child element of the xs:simpleType element or in the xs:maxExclusive/xs:maxInclusive/xs:minExclusive/xs:maxLength/xs:pattern facet of the child element.

  • jaxb:schemaBindings is specified in the xs:totalDigits/xs:whiteSpace facet of the child element of xs:restriction element.

Operations of Cosminexus XML Processor

The operations during the execution of JAXB when such a schema document is used are not regulated.

9

[Conditions]

When all of the following conditions are applicable:

  • The jaxb:schemaBindings custom binding in which the map attribute is false exists.

  • The jaxb:class or jaxb:typesafeEnumClass custom binding exists.

Operations of Cosminexus XML Processor

An error indicating invalid custom binding is output.

(Example)

[ERROR] compiler was unable to honor this class customization. It is attached to a wrong place, or its inconsistent with other bindings.

10

[Conditions]

When the jaxb:class custom binding is specified for the local element definition (xs:element containing =xs:complexType as the child element) whose type is defined as an anonymous complex type.

Operations of Cosminexus XML Processor

An error is output.

(Example)

Exception in thread "main" java.lang.IllegalArgumentException: Illegal class inheritance loop. Outer class element-name may not subclass from inner class: element-name

11

[Conditions]

When the jaxb:property custom binding is specified for xs:choice, xs:sequence, or xs:all specified in the complex type definition xs:restriction.

Operations of Cosminexus XML Processor

An error is output.

(Example)

[ERROR] compiler was unable to honor this property customization. It is attached to a wrong place, or its inconsistent with other bindings.

12

[Conditions]

When all of the following conditions are applicable:

  1. The jaxb:typesafeEnumClass custom binding is specified in the xs:complexType element.

  2. true, 1, or 0 is specified in the map attribute specified in the custom binding of condition 1.

Operation of Cosminexus XML Processor

The message KECX06051-E cvc-enumeration-valid: Value 'true' is not facet-valid with respect to enumeration '[false]'. It must be a value from the enumeration. occurs.

The value true specified in the map attribute is correct, but the specification of the jaxb:typesafeEnumClass custom binding in the xs:complexType element itself is invalid.

13

[Conditions]

When any of the following conditions are satisfied:

  • When any the following is specified in the collectionType attribute of jaxb:property:

    - An empty character string

    - A class in which java.util.List is not implemented

    - A class in which java.util.List is implemented, but not a completely modified class

  • When any the following is specified in the collectionType attribute of jaxb:globalBindings

    - A class in which java.util.List is not implemented

    - A class in which java.util.List is implemented, but the class is not completely modified

Operations of Cosminexus XML Processor

The java class is generated without an error occurrence.

14

[Conditions]

When specifying an empty character string is specified in the collectionType attribute of jaxb:globalBindings.

Operations of Cosminexus XML Processor

Throws the exception java.lang.StringIndexOutOfBoundsException.

15

[Conditions]

When any of the following conditions are satisfied:

  • Specify the following two attributes in the jaxb:class custom binding:

    - ref attribute

    - exclusive name attribute

  • Specify the following two attributes in the jaxb:class custom binding:

    - ref attribute

    - exclusive implClass attribute

  • Specify the following two attributes in the jaxb:typesafeEnumClass custom binding:

    - ref attribute

    - exclusive name attribute

  • Specify the following two attributes in the jaxb:typesafeEnumClass custom binding:

    - ref attribute

    - exclusive map attribute

Operations of Cosminexus XML Processor

An error does not occur. In such cases, the operations for executing JAXB are not defined.

16

[Conditions]

When all the following conditions are satisfied:

  • Specify the jaxb:class custom binding in the xs:element global element definition or the xs:element local element definition.

  • Specify the implClass attribute in the jaxb:class custom binding.

Operations of Cosminexus XML Processor

An error does not occur. In such cases, the operations for executing JAXB are not defined.

17

[Conditions]

When all the following condition are satisfied:

  • Specify the jaxb:typesafeEnumClass custom binding in the xs:simpleType definition of an enumerated facet.

  • Specify True, 1, or 0 in the map attribute of jaxb:typesafeEnumClass

Operations of Cosminexus XML Processor

An error does not occur. When the map attribute is not specified, the operations with the specified true or 1 will be executed by default.

18

[Conditions]

When all the following conditions are satisfied:

  • Specify the jaxb:property custom binding for a local or a global attribute declaration

  • Specify True, false, 1, or 0 in the generateElementProperty attribute.

Operations of Cosminexus XML Processor

An error does not occur. Java source including the property is output.

19

[Conditions]

When all the following conditions are satisfied:

  • Specify the jaxb:property custom binding for multiple element declarations with different name attributes in the same format.

  • Specify False in the generateElementProperty attribute

Operations of Cosminexus XML Processor

An error does not occur. Java source including JAXBElement is output.

20

[Conditions]

When any of the following conditions are satisfied:

  • Specify a class that does not exist in the same inheritance hierarchy as the default base type is specified, in the name attribute of the jaxb:baseType element.

  • Specify a class in which the Java class name is not fully modified, in the name attribute of the jaxb:baseType element.

Operations of Cosminexus XML Processor

An error does not occur. Java source is output.

21

[Conditions]

When the attachmentRef attribute of the jaxb:property custom binding is to be used.

Operations of Cosminexus XML Processor

The following error is output during the schema compilation:

[ERROR] KECX06031-E cvc-complex-type.3.2.2: Attribute 'attachmentRef' is not allowed to appear in element 'jaxb:property'.

22

[Conditions]

When specifying character strings other than asWordSeparator or asCharInWord, in the underscoreBinding attribute of the jaxb:globalBindings custom binding.

Operations of Cosminexus XML Processor

The NullPointerException exception is thrown.

23

[Conditions]

When specifying skipGeneration in the typesafeEnumMemberName attribute of the jaxb:globalBindings custom binding.

Operations of Cosminexus XML Processor

The following error is output:

KECX06051-E cvc-enumeration-valid: Value 'skipGeneration' is not facet-valid with respect to enumeration '[generateError, generateName]'. It must be a value from the enumeration.

Workaround

When the typesafeEnumMemberName attribute is not specified, the default operation changes to the skipGeneration operation.

24

[Conditions]

When specifying and customizing the jaxb:globalBindings custom bindings multiple times:

  • The xmlType attributes have different name attribute values, and the values of the xmlType attributes have same jaxb:javaType

  • jaxb:serializable with different uid attribute values

Operations of Cosminexus XML Processor

In such cases, the operations for executing JAXB are not defined.

25

[Conditions]

When all the following conditions are satisfied:

  • Specify primitive in the optionalProperty attribute of the jaxb:globalBindings custom binding.

  • Anyone of the following local element exists in the schema:

    - Primitive type element with the specified minOccurs="0".

    - Primitive type element defined in xs:choice

Operations of Cosminexus XML Processor

Output in wrapper class type and not the primitive type.

26

[Conditions]

When all the following conditions are satisfied:

  • Specify False in the generateElementProperty attribute of jaxb:globalBindings custom binding.

  • The specifications that become the property of the JAXBElement type, such as multiple elements with the same type and different names exist in the schema.

Operations of Cosminexus XML Processor

An error does not exist. In such case, the operations for executing JAXB are not defined.

27

[Conditions]

When specifying jaxb:inlineBinaryData in xs:complexType having simple contents of the binary type.

Operations of Cosminexus XML Processor

An invalid custom binding error is output.

Example:

[ERROR] compiler was unable to honor this inlineBinaryData customization. It is attached to a wrong place, or its inconsistent with other bindings.

28

[Conditions]

Anyone of the following conditions are satisfied:

  • Specify a non existing java data type in the name attribute of jaxb:javaType.

  • Specify the parseMethod attribute or the printMethod attribute of jaxb:javaType, and the primitive type in the name attribute.

  • In the name attribute of jaxb:javaType, specify the java data type for which a constructor with one argument of the String type is not defined.

Operations of Cosminexus XML Processor

An error does not occur.

29

The standard specifications provide the methods for customizing the contents of the documentation comments of Java classes generated using the jaxb:javadoc custom binding. Even when jaxb:javadoc is not specified, the default documentation comments are generated, but the contents are not provided in the standard specifications.

30

[Conditions]

When there is a simple type definition where the range specified in any of the xs:totalDigits, xs:maxExclusive, xs:maxInclusive, xs:minExclusive, or xs:minInclusive facets is within the int or long range.

Operations of Cosminexus XML Processor

java.math.BigInteger is generated always when the xs:totalDigits facet is used.

When the xs:maxExclusive, xs:maxInclusive, xs:minExclusive, or xs:minInclusive facet is used, the Java type is generated according to the algorithm specified in the subsection 6.2.2 of JSR 222 The Java Architecture for XML Binding 2.1.

31

[Conditions]

When a model group definition containing any of the following exists:

  • An anonymous complex type definition

  • xs:enumeration facet definition mapped in enum type

  • The contents model mapped in the element class

Operations of Cosminexus XML Processor

The model group name is not added to the created class name.

32

[Conditions]

When the jaxb:class custom binding is specified in the xs:element local element definition.

Operations of Cosminexus XML Processor

Inherits JAXBElement<T> and creates element factory method that returns the created classes.

(Example)

public class ObjectFactory {

public Base.Bar createBaseBar(String value) {

return new Base.Bar(value);

}

....

}

Note

Base.Bar is the class inheriting JAXBElement<T>.

33

[Conditions]

When all of the following conditions are applicable:

  1. The xs:element global element definition exists.

  2. The value of the abstract attribute specified in condition 1. is true.

Operations of Cosminexus XML Processor

The element factory method corresponding to the element definition is generated, but instances cannot be generated using the factory method.

34

[Conditions]

When either of the following is applicable to the schema document:

  • Element definitions with the same element name and different name space are specified in the contents model.

  • Two element definitions with element names class or Class and clazz or Clazz are specified in the contents model.

Operations of Cosminexus XML Processor

The name conflicting error does not occur, and the process is performed as a general contents list annotated by @XmlElementRef/@XmlElementRefs. For details about the contents list, see the subsection 6.12.3 of JSR 222 The Java Architecture for XML Binding 2.1.

35

[Conditions]

When either lax or skip is specified in the processContents attribute of xs:any.

Operations of Cosminexus XML Processor

The data type of the bind property will be the java.lang.Object type when the processContents attribute is lax, and the org.w3c.dom.Element type when the processContents attribute is skip.

36

[Conditions]

When the fixed attribute of the xs:element element is specified.

Operations of Cosminexus XML Processor

The value of the specified fixed attribute is not applied to the defaultValue element of @XmlElement and @XmlElementDecl of the Java source that is generated.

[Corrective action]

To apply the value of the fixed attribute as a default value, specify the default attribute instead of the fixed attribute.

37

[Conditions]

When a character string is specified in the value attribute of the xs:enumeration element in such a way so that there are conflicts in the generated java constant identifier.

(Example)

name-with-dashes and name_with_dashes

Operations of Cosminexus XML Processor

The enumeration definition is not output. No error occurs.

38

[Conditions]

When all of the following conditions are applicable to the URI specified in the targetNamespace attribute of the xs:schema element:

  • Top-level domains (such as com, gov, net, org, and edu) are not included.

  • The country code is not included.

Operations of Cosminexus XML Processor

The domain name of the package name of generated java source will be in the reverse order, and www. will be deleted.

39

[Conditions]

When any of the following is specified in the element name and attribute name:

  • java keyword

  • java literal (true, false, or null)

  • Method names defined in the java.lang.Object class

  • Method names defined in the javax.xml.bind class

Operations of Cosminexus XML Processor

The field and method name will be generated without the occurrence of a name conflicting error. A field name with an underscore"_" will be created for java keyword and java literal.

40

[Conditions]

When a redefined complex type definition exists.

Operations of Cosminexus XML Processor

For a redefined complex type definition, a class name with the prefix Original is generated instead of a class name with attached _.

41

[Conditions]

When all the following conditions are satisfied:

  • A model group definition exists.

  • Specify the suffix attribute or the prefix attribute of jaxb:modelGroupName in the jaxb:schemaBindings custom binding.

Operations of Cosminexus XML Processor

The model group definitions are not mapped in a class, so the specification of jaxb:modelGroupName is not applied to the generated source.

42

[Conditions]

When all the following conditions are satisfied:

  1. Specify asCharInWord in the underscoreBinding attribute of jaxb:globalBindings custom binding.

  2. Underline is included in the name attribute of xs:element or in the name attribute xs:attribute with the specified fixed attribute.

  3. For the name attribute of xs:attribute in step 2, True is specified in the fixedAttributeAsConstantProperty attribute of jaxb:globalBindings.

Operations of Cosminexus XML Processor

A Java identifier different from the specifications is generated.

Example:

  • For the name attribute of xs:element:

    child_element => getChild_Element (correct is getChild_element)

  • For the name attribute of xs:attribute:

    child_attribute => CHILD___ATTRIBUTE (correct is CHILD_ATTRIBUTE)

43

[Conditions]

When all the following conditions are satisfied:

  • In the enableJavaNamingConventions attribute of the jaxb:globalBindings custom binding, specify true or do not specify the attribute.

  • In the name attribute of jaxb:package that is the child element of jaxb:schemaBindings, specify an invalid value as a java identifier.

Operations of Cosminexus XML Processor

The conversion into an appropriate java identifier is not executed.

44

[Conditions]

When specifying jaxb:serializable without the uid attribute, in the jaxb:globalBindings custom binding.

Operations of Cosminexus XML Processor

An error does not occur. In such cases, the operations for executing JAXB are not defined.