users@jaxb.java.net

Only getXXX() is generated for list

From: Boming Zeng <boming_at_savvion.com>
Date: Wed, 23 Apr 2003 18:10:28 -0600

Hello,

I have a simple schema which defines an element "MyTest"
containing a sub-element "param", whose "maxOccurs"
attribute is "unbounded". In the generated class -
MyTestType.java, only getParam() is supplied, not the
corresponding setParam(List). Without setXXX(), how
could we set the value for this element?

If the maxOccurs attribute is removed, the generated
code will have both getParam() and setParam(). Could
somebody help clarify it?

thanks

Boming

<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
<xsd:element name="MyTest">
  <xsd:annotation>
    <xsd:documentation>A simple test for unbounded</xsd:documentation>
  </xsd:annotation>
  <xsd:complexType>
    <xsd:sequence>
      <xsd:element name="param" maxOccurs="unbounded">
        <xsd:complexType>
          <xsd:attribute name="colName" type="xsd:string" use="required"/>
        </xsd:complexType>
      </xsd:element>
    </xsd:sequence>
  </xsd:complexType>
</xsd:element>
</xsd:schema>

public interface MyTestType {
 java.util.List getParam();

 public interface ParamType {
  java.lang.String getColName();
  void setColName(java.lang.String value);
 }
}