jaxb
  1. jaxb
  2. JAXB-518

When XMLSchema is generated from Java with schemagen command, information on nillable of Java is not correctly reflected in XMLSchema.

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Won't Fix
    • Affects Version/s: 2.1.6
    • Fix Version/s: 2.1.13
    • Component/s: schemagen
    • Labels:
      None
    • Environment:

      Operating System: All
      Platform: All

    • Issuezilla Id:
      518

      Description

      When nillable is not specified for @XMLElement of Java, nillable ="true" is
      specified for XMLSchema generated with the schemagen command.

      Accoding to javadoc of javax.xml.bind.annotation.XmlElement.nillable, its
      default value is false.

      Moreover, when XMLSchema is the following, nillable is not actually specified
      for @XmlElement of the Java generated from the XMLSchema by xjc command.
      ・When you specify nillable ="false" for element of XMLSchema, or
      ・When you do not specify nillable for element of XMLSchema.

      Therefore, when Java is generated from XMLSchema of the above-mentioned
      condition, and XMLSchema is generated from that Java, the nillable attribute
      information of XMLSchema is different from former XMLSchema.

      (example)
      ----------------formar SCHEMA------------------
      <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
      <xs:schema version="1.0" targetNamespace="http://servlet_endpoint/"
      xmlns:tns="http://servlet_endpoint/" xmlns:ns1="http://jaxb.dev.java.net/array"
      xmlns:xs="http://www.w3.org/2001/XMLSchema">

      <xs:import namespace="http://jaxb.dev.java.net/array"
      schemaLocation="MultiTypeArrayService_schema2.xsd"/>

      <xs:element name="paramInInteger" type="tns:paramInInteger"/>

      <xs:element name="paramInIntegerResponse" type="tns:paramInIntegerResponse"/>

      <xs:complexType name="paramInInteger">
      <xs:sequence>
      <xs:element name="arg0" type="ns1:intArray" minOccurs="0"
      maxOccurs="unbounded"/>
      </xs:sequence>
      </xs:complexType>

      <xs:complexType name="paramInIntegerResponse">
      <xs:sequence>
      <xs:element name="return" type="xs:int"/>
      </xs:sequence>
      </xs:complexType>

      </xs:schema>

      ----------------generated Java------------------
      servlet_endpoint/ParamInInteger.java

      package servlet_endpoint;

      import java.util.ArrayList;
      import java.util.List;
      import javax.xml.bind.annotation.XmlAccessType;
      import javax.xml.bind.annotation.XmlAccessorType;
      import javax.xml.bind.annotation.XmlType;
      import net.java.dev.jaxb.array.IntArray;

      @XmlAccessorType(XmlAccessType.FIELD)
      @XmlType(name = "paramInInteger", propOrder = {
      "arg0"
      })
      public class ParamInInteger {

      protected List<IntArray> arg0;

      public List<IntArray> getArg0() {
      if (arg0 == null)

      { arg0 = new ArrayList<IntArray>(); }

      return this.arg0;
      }

      }
      ----------------generated SCHEMA------------------
      <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
      <xs:schema version="1.0" targetNamespace="http://servlet_endpoint/"
      xmlns:tns="http://servlet_endpoint/" xmlns:ns1="http://jaxb.dev.java.net/array"
      xmlns:xs="http://www.w3.org/2001/XMLSchema">

      <xs:import namespace="http://jaxb.dev.java.net/array"
      schemaLocation="MultiTypeArraySchema2.xsd"/>

      <xs:element name="paramInInteger" nillable="true" type="tns:paramInInteger"/>

      <xs:element name="paramInIntegerResponse" nillable="true"
      type="tns:paramInIntegerResponse"/>

      <xs:complexType name="paramInIntegerResponse">
      <xs:sequence>
      <xs:element name="return" type="xs:int"/>
      </xs:sequence>
      </xs:complexType>

      <xs:complexType name="paramInInteger">
      <xs:sequence>
      <xs:element name="arg0" type="ns1:intArray" nillable="true" minOccurs="0"
      maxOccurs="unbounded"/>
      </xs:sequence>
      </xs:complexType>
      </xs:schema>
      ------------------------------------------

      How about you though it thinks this to be an acute problem?

        Activity

          People

          • Assignee:
            Martin Grebac
            Reporter:
            taniguti
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: