axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sc...@apache.org
Subject cvs commit: xml-axis/java/src/org/apache/axis/wsdl/toJava ElementDecl.java SchemaUtils.java
Date Tue, 02 Apr 2002 23:09:47 GMT
scheu       02/04/02 15:09:47

  Modified:    java/src/org/apache/axis/wsdl/toJava ElementDecl.java
                        SchemaUtils.java
  Log:
  Added minOccursIs0 property to ElementDecl and changed SchemaUtils
  to set this property to true if a contained element has maxOccurs="0".
  
  This information is useful for the subtle distinction between nillable="true"
  and maxOccurs="0".  Currently the runtime assumes nillable="true" and
  sends null values as
    <someItem xsi:nill="true" />
  
  But if maxOccurs="0" is defined for the element, the element should not be
  serialized at all.
  
  Glen/Tom: You may want to change JavaBeanHelperWriter to store meta data
  for this case, add this information to the meta data model and change
  the BeanSerializer.
  
  Revision  Changes    Path
  1.3       +14 -0     xml-axis/java/src/org/apache/axis/wsdl/toJava/ElementDecl.java
  
  Index: ElementDecl.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/toJava/ElementDecl.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ElementDecl.java	19 Mar 2002 20:15:28 -0000	1.2
  +++ ElementDecl.java	2 Apr 2002 23:09:46 -0000	1.3
  @@ -67,6 +67,12 @@
   public class ElementDecl {
       private QName name;
       private TypeEntry type;
  +    // The following property is set if minOccurs=0.
  +    // An item that is not set and has minOccurs=0 
  +    // should not be passed over the wire.  This
  +    // is slightly different than nillable=true which
  +    // causes nil=true to be passed over the wire.
  +    private boolean minOccursIs0=false;   
   
       public ElementDecl() {
       }
  @@ -90,5 +96,13 @@
   
       public void setName(QName name) {
           this.name = name;
  +    }
  +
  +    public boolean getMinOccursIs0() {
  +        return minOccursIs0;
  +    }
  +
  +    public void setMinOccursIs0(boolean minOccursIs0) {
  +        this.minOccursIs0 = minOccursIs0;
       }
   }
  
  
  
  1.19      +6 -1      xml-axis/java/src/org/apache/axis/wsdl/toJava/SchemaUtils.java
  
  Index: SchemaUtils.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/toJava/SchemaUtils.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- SchemaUtils.java	2 Apr 2002 21:24:40 -0000	1.18
  +++ SchemaUtils.java	2 Apr 2002 23:09:46 -0000	1.19
  @@ -363,7 +363,12 @@
           TypeEntry type = (TypeEntry)symbolTable.getTypeEntry(nodeType, 
                                                                forElement.value);
           if (type != null) {
  -            return new ElementDecl(type, Utils.getAxisQName(nodeName));
  +            ElementDecl elem = new ElementDecl(type ,Utils.getAxisQName(nodeName));
  +            String minOccurs = Utils.getAttribute(elementNode, "minOccurs");
  +            if (minOccurs != null && minOccurs.equals("0")) {
  +                elem.setMinOccursIs0(true);
  +            }
  +            return elem;
           }
           
           return null;
  
  
  

Mime
View raw message