You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by Cédric Chabanois <CC...@natsystem.fr> on 2003/08/01 13:14:55 UTC
[patch] add a "nillable" attribute to ElementDecl.java
Hi,
I use wsdl2 to generate some code (not java) from wsdl.
The problem I had was that during generation, I did not know if an element
was nillable or not
(the nillable attribute in <xsd:element name="mapUrl" nillable="true"
type="xsd:string" />)
whereas I knew if minOccurs was 0 or not (because it is present in
ElementDecl and set in SchemaUtils.processChildElementNode)
The proposed patch add a nillable property to ElementDecl and set this
property in SchemaUtils.processChildElementNode.
This patch does not correct a bug but is somewhat related to bug 20109
Could you include it in Axis source code please ?
Cédric Chabanois
Here is the patch :
Index: ElementDecl.java
===================================================================
RCS file:
/home/cvspublic/xml-axis/java/src/org/apache/axis/wsdl/symbolTable/ElementDe
cl.java,v
retrieving revision 1.4
diff -u -r1.4 ElementDecl.java
--- ElementDecl.java 22 Apr 2003 19:36:14 -0000 1.4
+++ ElementDecl.java 31 Jul 2003 14:15:54 -0000
@@ -74,6 +74,8 @@
// causes nil=true to be passed over the wire.
private boolean minOccursIs0=false;
+ private boolean nillable=false;
+
// Indicate if the ElementDecl represents
// an xsd:any element
private boolean anyElement = false;
@@ -108,6 +110,14 @@
public void setMinOccursIs0(boolean minOccursIs0) {
this.minOccursIs0 = minOccursIs0;
+ }
+
+ public void setNillable(boolean nillable) {
+ this.nillable = nillable;
+ }
+
+ public boolean getNillable() {
+ return nillable;
}
public boolean getAnyElement() {
Index: SchemaUtils.java
===================================================================
RCS file:
/home/cvspublic/xml-axis/java/src/org/apache/axis/wsdl/symbolTable/SchemaUti
ls.java,v
retrieving revision 1.25
diff -u -r1.25 SchemaUtils.java
--- SchemaUtils.java 31 Jul 2003 06:25:18 -0000 1.25
+++ SchemaUtils.java 31 Jul 2003 14:15:56 -0000
@@ -55,6 +55,7 @@
package org.apache.axis.wsdl.symbolTable;
import org.apache.axis.Constants;
+import org.apache.axis.utils.JavaUtils;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
@@ -369,6 +370,9 @@
if (minOccurs != null && minOccurs.equals("0")) {
elem.setMinOccursIs0(true);
}
+
+
elem.setNillable(JavaUtils.isTrueExplicitly(Utils.getAttribute(elementNode,"
nillable")));
+
return elem;
}