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 ve...@apache.org on 2009/07/04 01:33:24 UTC

svn commit: r791036 - /webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/template/ADBBeanTemplate-helpermode.xsl

Author: veithen
Date: Fri Jul  3 23:33:24 2009
New Revision: 791036

URL: http://svn.apache.org/viewvc?rev=791036&view=rev
Log:
Change order of methods in helper mode template to match the normal mode template.

Modified:
    webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/template/ADBBeanTemplate-helpermode.xsl

Modified: webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/template/ADBBeanTemplate-helpermode.xsl
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/template/ADBBeanTemplate-helpermode.xsl?rev=791036&r1=791035&r2=791036&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/template/ADBBeanTemplate-helpermode.xsl (original)
+++ webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/template/ADBBeanTemplate-helpermode.xsl Fri Jul  3 23:33:24 2009
@@ -1389,6 +1389,282 @@
                 return dataSource;
             }
 
+     public static javax.xml.stream.XMLStreamReader getPullParser(java.lang.Object beanObject, javax.xml.namespace.QName qName)
+        throws org.apache.axis2.databinding.ADBException{
+
+        <xsl:value-of select="@package"/>.<xsl:value-of select="@name"/> bean =
+         (<xsl:value-of select="@package"/>.<xsl:value-of select="@name"/>)beanObject;
+
+        <xsl:choose>
+            <xsl:when test="@type or @anon">
+                 java.util.ArrayList elementList = new java.util.ArrayList();
+                 java.util.ArrayList attribList = new java.util.ArrayList();
+
+                <xsl:for-each select="property[not(@attribute)]">
+                    <xsl:variable name="propertyName"><xsl:value-of select="@name"/></xsl:variable>
+                    <xsl:variable name="varName">bean.local<xsl:value-of select="@javaname"/></xsl:variable>
+                    <xsl:variable name="min"><xsl:value-of select="@minOccurs"/></xsl:variable>
+                    <xsl:variable name="namespace"><xsl:value-of select="@nsuri"/></xsl:variable>
+                    <xsl:variable name="settingTracker">bean.local<xsl:value-of select="@javaname"/>Tracker</xsl:variable>
+
+
+                    <xsl:if test="$min=0 or $choice"> if (<xsl:value-of select="$settingTracker"/>){</xsl:if>
+                    <xsl:choose>
+                        <xsl:when test="(@ours or @default) and not(@array)">
+                            elementList.add(new javax.xml.namespace.QName("<xsl:value-of select="$namespace"/>",
+                                                                      "<xsl:value-of select="$propertyName"/>"));
+                            <!-- Arraylist can handle null's -->
+                            <xsl:choose>
+                                <xsl:when test="@nillable">
+                                    elementList.add(<xsl:value-of select="$varName"/>==null?null:
+                                    <xsl:value-of select="$varName"/>);
+                                </xsl:when>
+                                <xsl:otherwise>
+                                    if (<xsl:value-of select="$varName"/>==null){
+                                         throw new org.apache.axis2.databinding.ADBException("<xsl:value-of select="$propertyName"/> cannot be null!!");
+                                    }
+                                    elementList.add(<xsl:value-of select="$varName"/>);
+                                </xsl:otherwise>
+                            </xsl:choose>
+                        </xsl:when>
+                        <xsl:when test="(@ours or @default) and @array">
+                             if (<xsl:value-of select="$varName"/>!=null) {
+                                 for (int i = 0;i &lt; <xsl:value-of select="$varName"/>.length;i++){
+
+                                    if (<xsl:value-of select="$varName"/>[i] != null){
+                                         elementList.add(new javax.xml.namespace.QName("<xsl:value-of select="$namespace"/>",
+                                                                          "<xsl:value-of select="$propertyName"/>"));
+                                         elementList.add(<xsl:value-of select="$varName"/>[i]);
+                                    } else {
+                                        <xsl:choose>
+                                            <xsl:when test="@nillable">
+                                                elementList.add(new javax.xml.namespace.QName("<xsl:value-of select="$namespace"/>",
+                                                                          "<xsl:value-of select="$propertyName"/>"));
+                                                elementList.add(null);
+                                            </xsl:when>
+                                            <xsl:when test="$min=0">
+                                                // nothing to do
+                                            </xsl:when>
+                                            <xsl:otherwise>
+                                               throw new org.apache.axis2.databinding.ADBException("<xsl:value-of select="$propertyName"/> cannot be null !!");
+                                            </xsl:otherwise>
+                                        </xsl:choose>
+                                    }
+
+                                 }
+                             } else {
+                                 <xsl:choose>
+                                    <xsl:when test="@nillable">
+                                        elementList.add(new javax.xml.namespace.QName("<xsl:value-of select="$namespace"/>",
+                                                                          "<xsl:value-of select="$propertyName"/>"));
+                                        elementList.add(<xsl:value-of select="$varName"/>);
+                                    </xsl:when>
+                                    <xsl:otherwise>
+                                        throw new org.apache.axis2.databinding.ADBException("<xsl:value-of select="$propertyName"/> cannot be null!!");
+                                    </xsl:otherwise>
+                                </xsl:choose>
+                             }
+
+                        </xsl:when>
+                        <!-- handle non ADB arrays - Not any however -->
+                        <xsl:when test="@array and not(@any)">
+                            if (<xsl:value-of select="$varName"/>!=null){
+                                  for (int i = 0;i &lt; <xsl:value-of select="$varName"/>.length;i++){
+                                      <xsl:if test="not(@primitive)">
+                                         if (<xsl:value-of select="$varName"/>[i] != null){
+                                          elementList.add(new javax.xml.namespace.QName("<xsl:value-of select="$namespace"/>",
+                                                                              "<xsl:value-of select="$propertyName"/>"));
+                                          elementList.add(
+                                          org.apache.axis2.databinding.utils.ConverterUtil.convertToString(<xsl:value-of select="$varName"/>[i]));
+                                          } else {
+                                             <xsl:choose>
+                                                <xsl:when test="@nillable">
+                                                    elementList.add(new javax.xml.namespace.QName("<xsl:value-of select="$namespace"/>",
+                                                                              "<xsl:value-of select="$propertyName"/>"));
+                                                    elementList.add(null);
+                                                </xsl:when>
+                                                <xsl:when test="$min=0">
+                                                    // have to do nothing
+                                                </xsl:when>
+                                                <xsl:otherwise>
+                                                    throw new org.apache.axis2.databinding.ADBException("<xsl:value-of select="$propertyName"/> cannot be null!!");
+                                                </xsl:otherwise>
+                                            </xsl:choose>
+                                          }
+                                      </xsl:if>
+                                      <xsl:if test="@primitive">
+                                          elementList.add(new javax.xml.namespace.QName("<xsl:value-of select="$namespace"/>",
+                                                                                                                       "<xsl:value-of select="$propertyName"/>"));
+                                          elementList.add(
+                                          org.apache.axis2.databinding.utils.ConverterUtil.convertToString(<xsl:value-of select="$varName"/>[i]));
+
+                                      </xsl:if>
+
+                                  }
+                            } else {
+                              <xsl:choose>
+                                <xsl:when test="@nillable">
+                                    elementList.add(new javax.xml.namespace.QName("<xsl:value-of select="$namespace"/>",
+                                                                              "<xsl:value-of select="$propertyName"/>"));
+                                    elementList.add(null);
+                                </xsl:when>
+                                <xsl:otherwise>
+                                    throw new org.apache.axis2.databinding.ADBException("<xsl:value-of select="$propertyName"/> cannot be null!!");
+                                </xsl:otherwise>
+                               </xsl:choose>
+                            }
+
+                        </xsl:when>
+
+                         <!-- handle non ADB arrays  - Any case  - any may not be
+                         nillable -->
+                        <xsl:when test="@array and @any">
+                            if (<xsl:value-of select="$varName"/> != null) {
+                                for (int i = 0;i &lt; <xsl:value-of select="$varName"/>.length;i++){
+                                    if (<xsl:value-of select="$varName"/>[i] != null){
+                                       elementList.add(new javax.xml.namespace.QName("<xsl:value-of select="$namespace"/>",
+                                                                          "<xsl:value-of select="$propertyName"/>"));
+                                      elementList.add(
+                                      org.apache.axis2.databinding.utils.ConverterUtil.convertToString(<xsl:value-of select="$varName"/>[i]));
+                                    } else {
+                                        <xsl:choose>
+                                            <xsl:when test="$min=0">
+                                                // have to do nothing
+                                            </xsl:when>
+                                            <xsl:otherwise>
+                                                throw new org.apache.axis2.databinding.ADBException("<xsl:value-of select="$propertyName"/> cannot be null!!");
+                                            </xsl:otherwise>
+                                        </xsl:choose>
+                                    }
+
+                                }
+                            } else {
+                               throw new org.apache.axis2.databinding.ADBException("<xsl:value-of select="$propertyName"/> cannot be null!!");
+                            }
+                        </xsl:when>
+                        <!-- handle any - non array case-->
+                         <xsl:when test="@any">
+                            if (<xsl:value-of select="$varName"/> != null){
+                                elementList.add(org.apache.axis2.databinding.utils.Constants.OM_ELEMENT_KEY);
+                                elementList.add(<xsl:value-of select="$varName"/>);
+                            } else {
+                               throw new org.apache.axis2.databinding.ADBException("<xsl:value-of select="$propertyName"/> cannot be null!!");
+                            }
+                        </xsl:when>
+                        <!-- handle binary - Since it is a Datahandler, we can just add it to the list
+                          and the ADB pullparser would handle it right-->
+                         <xsl:when test="@binary">
+                            elementList.add(new javax.xml.namespace.QName("<xsl:value-of select="$namespace"/>",
+                                                                      "<xsl:value-of select="$propertyName"/>"));
+                            elementList.add(<xsl:value-of select="$varName"/>);
+                        </xsl:when>
+                        <!-- the usual case!!!!-->
+                        <xsl:otherwise>
+                             elementList.add(new javax.xml.namespace.QName("<xsl:value-of select="$namespace"/>",
+                                                                      "<xsl:value-of select="$propertyName"/>"));
+                            <xsl:if test="@primitive">
+                                elementList.add(
+                                   org.apache.axis2.databinding.utils.ConverterUtil.convertToString(<xsl:value-of select="$varName"/>));
+                            </xsl:if>
+                            <xsl:if test="not(@primitive)">
+                                 <xsl:choose>
+                                    <xsl:when test="@nillable">
+                                         elementList.add(<xsl:value-of select="$varName"/>==null?null:
+                                         org.apache.axis2.databinding.utils.ConverterUtil.convertToString(<xsl:value-of select="$varName"/>));
+                                    </xsl:when>
+                                    <xsl:otherwise>
+                                        if (<xsl:value-of select="$varName"/> != null){
+                                            elementList.add(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(<xsl:value-of select="$varName"/>));
+                                        } else {
+                                           throw new org.apache.axis2.databinding.ADBException("<xsl:value-of select="$propertyName"/> cannot be null!!");
+                                        }
+                                    </xsl:otherwise>
+                                </xsl:choose>
+                           </xsl:if>
+
+                        </xsl:otherwise>
+                    </xsl:choose>
+                    <xsl:if test="$min=0 or $choice">}</xsl:if>
+                </xsl:for-each>
+
+                <xsl:for-each select="property[@attribute]">
+                    <xsl:variable name="propertyName"><xsl:value-of select="@name"/></xsl:variable>
+                    <xsl:variable name="varName">bean.local<xsl:value-of select="@javaname"/></xsl:variable>
+                     <xsl:variable name="namespace"><xsl:value-of select="@nsuri"/></xsl:variable>
+                    <xsl:choose>
+                        <xsl:when test="@any and not(@array)">
+                            attribList.add(org.apache.axis2.databinding.utils.Constants.OM_ATTRIBUTE_KEY);
+                            attribList.add(<xsl:value-of select="$varName"/>);
+                        </xsl:when>
+                         <xsl:when test="@any and @array">
+                             for (int i=0;i &lt;<xsl:value-of select="$varName"/>.length;i++){
+                               attribList.add(org.apache.axis2.databinding.utils.Constants.OM_ATTRIBUTE_KEY);
+                               attribList.add(<xsl:value-of select="$varName"/>[i]);
+                             }
+                         </xsl:when>
+                        <xsl:otherwise>
+                            attribList.add(
+                            new javax.xml.namespace.QName("<xsl:value-of select="$namespace"/>","<xsl:value-of select="$propertyName"/>"));
+                            attribList.add(
+                            org.apache.axis2.databinding.utils.ConverterUtil.convertToString(<xsl:value-of select="$varName"/>));
+                        </xsl:otherwise>
+                    </xsl:choose>
+                </xsl:for-each>
+
+                return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray());
+            <!-- end of when for type & anon -->
+            </xsl:when>
+            <!-- Not a type and not anon. So it better be only one inclusion-->
+            <xsl:otherwise>
+                <!-- if the element is associated with a type, then its gonna be only one -->
+                //We can safely assume an element has only one type associated with it
+                <xsl:variable name="varName">bean.local<xsl:value-of select="property/@javaname"/></xsl:variable>
+                <xsl:variable name="nillable" select="property/@nillable"></xsl:variable>
+                <xsl:variable name="primitive" select="property/@primitive"></xsl:variable>
+                <xsl:variable name="propertyType" select="property/@type"></xsl:variable>
+
+                <xsl:choose>
+                    <!-- This better be only one!!-->
+                    <xsl:when test="property/@ours">
+
+                        <xsl:choose>
+                            <xsl:when test="$nillable">
+                                if (<xsl:value-of select="$varName"/>==null){
+                                   return new org.apache.axis2.databinding.utils.reader.NullXMLStreamReader(bean.MY_QNAME);
+                                }else{
+                                   return <xsl:value-of select="$propertyType"/>Helper.getPullParser(<xsl:value-of select="$varName"/>,bean.MY_QNAME);
+                                }
+                            </xsl:when>
+                            <xsl:otherwise>return <xsl:value-of select="$propertyType"/>Helper.getPullParser(<xsl:value-of select="$varName"/>,bean.MY_QNAME);</xsl:otherwise>
+                        </xsl:choose>
+                    </xsl:when>
+                    <xsl:otherwise>
+                        <xsl:choose>
+                            <xsl:when test="$nillable and not($primitive)">
+                                if (<xsl:value-of select="$varName"/>==null){
+                                      return new org.apache.axis2.databinding.utils.reader.NullXMLStreamReader(bean.MY_QNAME);
+                                }else{
+                                   return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(bean.MY_QNAME,
+                                       new java.lang.Object[]{
+                                      org.apache.axis2.databinding.utils.reader.ADBXMLStreamReader.ELEMENT_TEXT,
+                                       org.apache.axis2.databinding.utils.ConverterUtil.convertToString(<xsl:value-of select="$varName"/>)
+                                       },
+                                       null);
+                                }
+                            </xsl:when>
+                            <xsl:otherwise> return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(bean.MY_QNAME,
+                            new java.lang.Object[]{
+                            org.apache.axis2.databinding.utils.reader.ADBXMLStreamReader.ELEMENT_TEXT,
+                            org.apache.axis2.databinding.utils.ConverterUtil.convertToString(<xsl:value-of select="$varName"/>)
+                            },
+                            null);</xsl:otherwise>
+                        </xsl:choose>
+                    </xsl:otherwise>
+                </xsl:choose>
+            </xsl:otherwise>
+        </xsl:choose>
+
+        }
 
         /**
         * static method to create the object
@@ -2017,407 +2293,131 @@
                                      object.set<xsl:value-of select="$javaName"/>(<xsl:value-of select="$builderName"/>.getOMElement().getFirstElement());
                                      <xsl:if test="$isType or $anon">  <!-- This is a subelement property to be consumed -->
                                          reader.next();
-                                     </xsl:if>
-                                </xsl:when>
-                                <!-- end of OMelement handling -->
-                                <!-- start of the simple types handling for binary content-->
-                                <xsl:when test="@binary">
-                                    <xsl:if test="not($simple)">reader.next();</xsl:if>
-                                    if (isReaderMTOMAware(reader)
-                                            &amp;&amp;
-                                            java.lang.Boolean.TRUE.equals(reader.getProperty(org.apache.axiom.om.OMConstants.IS_BINARY)))
-                                    {
-                                        //MTOM aware reader - get the datahandler directly and put it in the object
-                                        object.set<xsl:value-of select="$javaName"/>(
-                                                (javax.activation.DataHandler) reader.getProperty(org.apache.axiom.om.OMConstants.DATA_HANDLER));
-                                    } else {
-                                        if (reader.getEventType() == javax.xml.stream.XMLStreamConstants.START_ELEMENT &amp;&amp; reader.getName().equals(new javax.xml.namespace.QName(org.apache.axiom.om.impl.MTOMConstants.XOP_NAMESPACE_URI, org.apache.axiom.om.impl.MTOMConstants.XOP_INCLUDE)))
-                                        {
-                                            java.lang.String id = org.apache.axiom.om.util.ElementHelper.getContentID(reader, "UTF-8");
-                                            object.set<xsl:value-of select="$javaName"/>(((org.apache.axiom.soap.impl.builder.MTOMStAXSOAPModelBuilder) ((org.apache.axiom.om.impl.llom.OMStAXWrapper) reader).getBuilder()).getDataHandler(id));
-                                            reader.next();
-                                            <xsl:if test="($isType or $anon) and not($simple)">
-                                                reader.next();
-                                            </xsl:if>
-                                        } else if(reader.hasText()) {
-                                            //Do the usual conversion
-                                            java.lang.String content = reader.getText();
-                                            object.set<xsl:value-of select="$javaName"/>(
-                                                    org.apache.axis2.databinding.utils.ConverterUtil.convertToBase64Binary(content));
-                                            <xsl:if test="($isType or $anon) and not($simple)">
-                                                reader.next();
-                                            </xsl:if>
-                                        }
-                                    }
-
-                                    <xsl:if test="$isType or $anon">  <!-- This is a subelement property to be consumed -->
-                                        reader.next();
-                                    </xsl:if>
-                                </xsl:when>
-                                <!-- start of the simple types handling -->
-                                <xsl:otherwise>
-                                    <xsl:if test="@nillable">
-                                       nillableValue = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","nil");
-                                       if (!"true".equals(nillableValue) &amp;&amp; !"1".equals(nillableValue)){
-                                    </xsl:if>
-                                    java.lang.String content = reader.getElementText();
-                                    <xsl:if test="not(enumFacet)">
-                                        <xsl:choose>
-                                            <xsl:when test="$propertyType='javax.xml.namespace.QName'">
-                                            int index = content.indexOf(":");
-                                            java.lang.String prefix ="";
-                                            java.lang.String namespaceuri ="";
-                                            if(index > 0){
-                                                 prefix = content.substring(0,index);
-                                                 namespaceuri = reader.getNamespaceURI(prefix);
-                                             }
-                                             object.set<xsl:value-of select="$javaName"/>(
-                                                  org.apache.axis2.databinding.utils.ConverterUtil.convertToQName(content,namespaceuri));
-                                            </xsl:when>
-                                            <xsl:when test="$propertyType='org.apache.axiom.om.OMElement'">
-                                                org.apache.axiom.om.OMFactory fac = org.apache.axiom.om.OMAbstractFactory.getOMFactory();
-                                                org.apache.axiom.om.OMNamespace omNs = fac.createOMNamespace("<xsl:value-of select="$namespace"/>", "");
-                                                org.apache.axiom.om.OMElement _value<xsl:value-of select="$javaName"/> = fac.createOMElement("<xsl:value-of select="$propertyName"/>", omNs);
-                                                _value<xsl:value-of select="$javaName"/>.addChild(fac.createOMText(_value<xsl:value-of select="$javaName"/>, content));
-                                                object.set<xsl:value-of select="$javaName"/>(_value<xsl:value-of select="$javaName"/>);
-                                            </xsl:when>
-                                            <xsl:otherwise>
-                                              object.set<xsl:value-of select="$javaName"/>(
-                                                    org.apache.axis2.databinding.utils.ConverterUtil.convertTo<xsl:value-of select="$shortTypeName"/>(content));
-                                            </xsl:otherwise>
-                                        </xsl:choose>
-                                    </xsl:if>
-                                    <xsl:if test="(enumFacet)">
-                                    object = <xsl:value-of select="$name"/>.fromString(content);
-                                    </xsl:if>
-                                    <xsl:if test="@nillable">
-                                       } else {
-                                           reader.getElementText(); // throw away text nodes if any.
-                                       }
-                                    </xsl:if>
-                                    <xsl:if test="($isType or $anon) and not($simple)">  <!-- This is a subelement property to be consumed -->
-                                        reader.next();
-                                    </xsl:if>
-                                </xsl:otherwise>
-                            </xsl:choose>
-                            <xsl:if test="not(enumFacet)">
-                              }  // End of if for expected property start element
-                            </xsl:if>
-                            <xsl:if test="$ordered and $min!=0">
-                                else{
-                                    // A start element we are not expecting indicates an invalid parameter was passed
-                                    throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getLocalName());
-                                }
-                            </xsl:if>
-                        </xsl:for-each>
-
-                        <xsl:if test="$ordered">  <!-- pick up trailing cruft after final property before outer endElement and verify no trailing properties -->
-                            while (!reader.isStartElement() &amp;&amp; !reader.isEndElement())
-                                reader.next();
-                            if (reader.isStartElement())
-                                // A start element we are not expecting indicates a trailing invalid property
-                                throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getLocalName());
-                        </xsl:if>
-
-                        <xsl:if test="property[not(@attribute)]">  <!-- this if is needed to skip all this when there are no propoerties-->
-                        <xsl:if test="$unordered">
-                          <xsl:if test="not(property/enumFacet)">
-                             else{
-                                        // A start element we are not expecting indicates an invalid parameter was passed
-                                        throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getLocalName());
-                             }
-                          </xsl:if>
-                             } else reader.next();  <!-- At neither a start nor an end element, skip it -->
-                            }  // end of while loop
-                        </xsl:if>
-                        </xsl:if>
-
-
-            } catch (javax.xml.stream.XMLStreamException e) {
-                throw new java.lang.Exception(e);
-            }
-
-            return object;
-        }
-
-
-     public static javax.xml.stream.XMLStreamReader getPullParser(java.lang.Object beanObject, javax.xml.namespace.QName qName)
-        throws org.apache.axis2.databinding.ADBException{
-
-        <xsl:value-of select="@package"/>.<xsl:value-of select="@name"/> bean =
-         (<xsl:value-of select="@package"/>.<xsl:value-of select="@name"/>)beanObject;
-
-        <xsl:choose>
-            <xsl:when test="@type or @anon">
-                 java.util.ArrayList elementList = new java.util.ArrayList();
-                 java.util.ArrayList attribList = new java.util.ArrayList();
-
-                <xsl:for-each select="property[not(@attribute)]">
-                    <xsl:variable name="propertyName"><xsl:value-of select="@name"/></xsl:variable>
-                    <xsl:variable name="varName">bean.local<xsl:value-of select="@javaname"/></xsl:variable>
-                    <xsl:variable name="min"><xsl:value-of select="@minOccurs"/></xsl:variable>
-                    <xsl:variable name="namespace"><xsl:value-of select="@nsuri"/></xsl:variable>
-                    <xsl:variable name="settingTracker">bean.local<xsl:value-of select="@javaname"/>Tracker</xsl:variable>
-
-
-                    <xsl:if test="$min=0 or $choice"> if (<xsl:value-of select="$settingTracker"/>){</xsl:if>
-                    <xsl:choose>
-                        <xsl:when test="(@ours or @default) and not(@array)">
-                            elementList.add(new javax.xml.namespace.QName("<xsl:value-of select="$namespace"/>",
-                                                                      "<xsl:value-of select="$propertyName"/>"));
-                            <!-- Arraylist can handle null's -->
-                            <xsl:choose>
-                                <xsl:when test="@nillable">
-                                    elementList.add(<xsl:value-of select="$varName"/>==null?null:
-                                    <xsl:value-of select="$varName"/>);
-                                </xsl:when>
-                                <xsl:otherwise>
-                                    if (<xsl:value-of select="$varName"/>==null){
-                                         throw new org.apache.axis2.databinding.ADBException("<xsl:value-of select="$propertyName"/> cannot be null!!");
-                                    }
-                                    elementList.add(<xsl:value-of select="$varName"/>);
-                                </xsl:otherwise>
-                            </xsl:choose>
-                        </xsl:when>
-                        <xsl:when test="(@ours or @default) and @array">
-                             if (<xsl:value-of select="$varName"/>!=null) {
-                                 for (int i = 0;i &lt; <xsl:value-of select="$varName"/>.length;i++){
-
-                                    if (<xsl:value-of select="$varName"/>[i] != null){
-                                         elementList.add(new javax.xml.namespace.QName("<xsl:value-of select="$namespace"/>",
-                                                                          "<xsl:value-of select="$propertyName"/>"));
-                                         elementList.add(<xsl:value-of select="$varName"/>[i]);
-                                    } else {
-                                        <xsl:choose>
-                                            <xsl:when test="@nillable">
-                                                elementList.add(new javax.xml.namespace.QName("<xsl:value-of select="$namespace"/>",
-                                                                          "<xsl:value-of select="$propertyName"/>"));
-                                                elementList.add(null);
-                                            </xsl:when>
-                                            <xsl:when test="$min=0">
-                                                // nothing to do
-                                            </xsl:when>
-                                            <xsl:otherwise>
-                                               throw new org.apache.axis2.databinding.ADBException("<xsl:value-of select="$propertyName"/> cannot be null !!");
-                                            </xsl:otherwise>
-                                        </xsl:choose>
-                                    }
-
-                                 }
-                             } else {
-                                 <xsl:choose>
-                                    <xsl:when test="@nillable">
-                                        elementList.add(new javax.xml.namespace.QName("<xsl:value-of select="$namespace"/>",
-                                                                          "<xsl:value-of select="$propertyName"/>"));
-                                        elementList.add(<xsl:value-of select="$varName"/>);
-                                    </xsl:when>
-                                    <xsl:otherwise>
-                                        throw new org.apache.axis2.databinding.ADBException("<xsl:value-of select="$propertyName"/> cannot be null!!");
-                                    </xsl:otherwise>
-                                </xsl:choose>
-                             }
-
-                        </xsl:when>
-                        <!-- handle non ADB arrays - Not any however -->
-                        <xsl:when test="@array and not(@any)">
-                            if (<xsl:value-of select="$varName"/>!=null){
-                                  for (int i = 0;i &lt; <xsl:value-of select="$varName"/>.length;i++){
-                                      <xsl:if test="not(@primitive)">
-                                         if (<xsl:value-of select="$varName"/>[i] != null){
-                                          elementList.add(new javax.xml.namespace.QName("<xsl:value-of select="$namespace"/>",
-                                                                              "<xsl:value-of select="$propertyName"/>"));
-                                          elementList.add(
-                                          org.apache.axis2.databinding.utils.ConverterUtil.convertToString(<xsl:value-of select="$varName"/>[i]));
-                                          } else {
-                                             <xsl:choose>
-                                                <xsl:when test="@nillable">
-                                                    elementList.add(new javax.xml.namespace.QName("<xsl:value-of select="$namespace"/>",
-                                                                              "<xsl:value-of select="$propertyName"/>"));
-                                                    elementList.add(null);
-                                                </xsl:when>
-                                                <xsl:when test="$min=0">
-                                                    // have to do nothing
-                                                </xsl:when>
-                                                <xsl:otherwise>
-                                                    throw new org.apache.axis2.databinding.ADBException("<xsl:value-of select="$propertyName"/> cannot be null!!");
-                                                </xsl:otherwise>
-                                            </xsl:choose>
-                                          }
-                                      </xsl:if>
-                                      <xsl:if test="@primitive">
-                                          elementList.add(new javax.xml.namespace.QName("<xsl:value-of select="$namespace"/>",
-                                                                                                                       "<xsl:value-of select="$propertyName"/>"));
-                                          elementList.add(
-                                          org.apache.axis2.databinding.utils.ConverterUtil.convertToString(<xsl:value-of select="$varName"/>[i]));
-
-                                      </xsl:if>
+                                     </xsl:if>
+                                </xsl:when>
+                                <!-- end of OMelement handling -->
+                                <!-- start of the simple types handling for binary content-->
+                                <xsl:when test="@binary">
+                                    <xsl:if test="not($simple)">reader.next();</xsl:if>
+                                    if (isReaderMTOMAware(reader)
+                                            &amp;&amp;
+                                            java.lang.Boolean.TRUE.equals(reader.getProperty(org.apache.axiom.om.OMConstants.IS_BINARY)))
+                                    {
+                                        //MTOM aware reader - get the datahandler directly and put it in the object
+                                        object.set<xsl:value-of select="$javaName"/>(
+                                                (javax.activation.DataHandler) reader.getProperty(org.apache.axiom.om.OMConstants.DATA_HANDLER));
+                                    } else {
+                                        if (reader.getEventType() == javax.xml.stream.XMLStreamConstants.START_ELEMENT &amp;&amp; reader.getName().equals(new javax.xml.namespace.QName(org.apache.axiom.om.impl.MTOMConstants.XOP_NAMESPACE_URI, org.apache.axiom.om.impl.MTOMConstants.XOP_INCLUDE)))
+                                        {
+                                            java.lang.String id = org.apache.axiom.om.util.ElementHelper.getContentID(reader, "UTF-8");
+                                            object.set<xsl:value-of select="$javaName"/>(((org.apache.axiom.soap.impl.builder.MTOMStAXSOAPModelBuilder) ((org.apache.axiom.om.impl.llom.OMStAXWrapper) reader).getBuilder()).getDataHandler(id));
+                                            reader.next();
+                                            <xsl:if test="($isType or $anon) and not($simple)">
+                                                reader.next();
+                                            </xsl:if>
+                                        } else if(reader.hasText()) {
+                                            //Do the usual conversion
+                                            java.lang.String content = reader.getText();
+                                            object.set<xsl:value-of select="$javaName"/>(
+                                                    org.apache.axis2.databinding.utils.ConverterUtil.convertToBase64Binary(content));
+                                            <xsl:if test="($isType or $anon) and not($simple)">
+                                                reader.next();
+                                            </xsl:if>
+                                        }
+                                    }
 
-                                  }
-                            } else {
-                              <xsl:choose>
-                                <xsl:when test="@nillable">
-                                    elementList.add(new javax.xml.namespace.QName("<xsl:value-of select="$namespace"/>",
-                                                                              "<xsl:value-of select="$propertyName"/>"));
-                                    elementList.add(null);
+                                    <xsl:if test="$isType or $anon">  <!-- This is a subelement property to be consumed -->
+                                        reader.next();
+                                    </xsl:if>
                                 </xsl:when>
+                                <!-- start of the simple types handling -->
                                 <xsl:otherwise>
-                                    throw new org.apache.axis2.databinding.ADBException("<xsl:value-of select="$propertyName"/> cannot be null!!");
-                                </xsl:otherwise>
-                               </xsl:choose>
-                            }
-
-                        </xsl:when>
-
-                         <!-- handle non ADB arrays  - Any case  - any may not be
-                         nillable -->
-                        <xsl:when test="@array and @any">
-                            if (<xsl:value-of select="$varName"/> != null) {
-                                for (int i = 0;i &lt; <xsl:value-of select="$varName"/>.length;i++){
-                                    if (<xsl:value-of select="$varName"/>[i] != null){
-                                       elementList.add(new javax.xml.namespace.QName("<xsl:value-of select="$namespace"/>",
-                                                                          "<xsl:value-of select="$propertyName"/>"));
-                                      elementList.add(
-                                      org.apache.axis2.databinding.utils.ConverterUtil.convertToString(<xsl:value-of select="$varName"/>[i]));
-                                    } else {
+                                    <xsl:if test="@nillable">
+                                       nillableValue = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","nil");
+                                       if (!"true".equals(nillableValue) &amp;&amp; !"1".equals(nillableValue)){
+                                    </xsl:if>
+                                    java.lang.String content = reader.getElementText();
+                                    <xsl:if test="not(enumFacet)">
                                         <xsl:choose>
-                                            <xsl:when test="$min=0">
-                                                // have to do nothing
+                                            <xsl:when test="$propertyType='javax.xml.namespace.QName'">
+                                            int index = content.indexOf(":");
+                                            java.lang.String prefix ="";
+                                            java.lang.String namespaceuri ="";
+                                            if(index > 0){
+                                                 prefix = content.substring(0,index);
+                                                 namespaceuri = reader.getNamespaceURI(prefix);
+                                             }
+                                             object.set<xsl:value-of select="$javaName"/>(
+                                                  org.apache.axis2.databinding.utils.ConverterUtil.convertToQName(content,namespaceuri));
+                                            </xsl:when>
+                                            <xsl:when test="$propertyType='org.apache.axiom.om.OMElement'">
+                                                org.apache.axiom.om.OMFactory fac = org.apache.axiom.om.OMAbstractFactory.getOMFactory();
+                                                org.apache.axiom.om.OMNamespace omNs = fac.createOMNamespace("<xsl:value-of select="$namespace"/>", "");
+                                                org.apache.axiom.om.OMElement _value<xsl:value-of select="$javaName"/> = fac.createOMElement("<xsl:value-of select="$propertyName"/>", omNs);
+                                                _value<xsl:value-of select="$javaName"/>.addChild(fac.createOMText(_value<xsl:value-of select="$javaName"/>, content));
+                                                object.set<xsl:value-of select="$javaName"/>(_value<xsl:value-of select="$javaName"/>);
                                             </xsl:when>
                                             <xsl:otherwise>
-                                                throw new org.apache.axis2.databinding.ADBException("<xsl:value-of select="$propertyName"/> cannot be null!!");
+                                              object.set<xsl:value-of select="$javaName"/>(
+                                                    org.apache.axis2.databinding.utils.ConverterUtil.convertTo<xsl:value-of select="$shortTypeName"/>(content));
                                             </xsl:otherwise>
                                         </xsl:choose>
-                                    }
-
+                                    </xsl:if>
+                                    <xsl:if test="(enumFacet)">
+                                    object = <xsl:value-of select="$name"/>.fromString(content);
+                                    </xsl:if>
+                                    <xsl:if test="@nillable">
+                                       } else {
+                                           reader.getElementText(); // throw away text nodes if any.
+                                       }
+                                    </xsl:if>
+                                    <xsl:if test="($isType or $anon) and not($simple)">  <!-- This is a subelement property to be consumed -->
+                                        reader.next();
+                                    </xsl:if>
+                                </xsl:otherwise>
+                            </xsl:choose>
+                            <xsl:if test="not(enumFacet)">
+                              }  // End of if for expected property start element
+                            </xsl:if>
+                            <xsl:if test="$ordered and $min!=0">
+                                else{
+                                    // A start element we are not expecting indicates an invalid parameter was passed
+                                    throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getLocalName());
                                 }
-                            } else {
-                               throw new org.apache.axis2.databinding.ADBException("<xsl:value-of select="$propertyName"/> cannot be null!!");
-                            }
-                        </xsl:when>
-                        <!-- handle any - non array case-->
-                         <xsl:when test="@any">
-                            if (<xsl:value-of select="$varName"/> != null){
-                                elementList.add(org.apache.axis2.databinding.utils.Constants.OM_ELEMENT_KEY);
-                                elementList.add(<xsl:value-of select="$varName"/>);
-                            } else {
-                               throw new org.apache.axis2.databinding.ADBException("<xsl:value-of select="$propertyName"/> cannot be null!!");
-                            }
-                        </xsl:when>
-                        <!-- handle binary - Since it is a Datahandler, we can just add it to the list
-                          and the ADB pullparser would handle it right-->
-                         <xsl:when test="@binary">
-                            elementList.add(new javax.xml.namespace.QName("<xsl:value-of select="$namespace"/>",
-                                                                      "<xsl:value-of select="$propertyName"/>"));
-                            elementList.add(<xsl:value-of select="$varName"/>);
-                        </xsl:when>
-                        <!-- the usual case!!!!-->
-                        <xsl:otherwise>
-                             elementList.add(new javax.xml.namespace.QName("<xsl:value-of select="$namespace"/>",
-                                                                      "<xsl:value-of select="$propertyName"/>"));
-                            <xsl:if test="@primitive">
-                                elementList.add(
-                                   org.apache.axis2.databinding.utils.ConverterUtil.convertToString(<xsl:value-of select="$varName"/>));
                             </xsl:if>
-                            <xsl:if test="not(@primitive)">
-                                 <xsl:choose>
-                                    <xsl:when test="@nillable">
-                                         elementList.add(<xsl:value-of select="$varName"/>==null?null:
-                                         org.apache.axis2.databinding.utils.ConverterUtil.convertToString(<xsl:value-of select="$varName"/>));
-                                    </xsl:when>
-                                    <xsl:otherwise>
-                                        if (<xsl:value-of select="$varName"/> != null){
-                                            elementList.add(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(<xsl:value-of select="$varName"/>));
-                                        } else {
-                                           throw new org.apache.axis2.databinding.ADBException("<xsl:value-of select="$propertyName"/> cannot be null!!");
-                                        }
-                                    </xsl:otherwise>
-                                </xsl:choose>
-                           </xsl:if>
+                        </xsl:for-each>
 
-                        </xsl:otherwise>
-                    </xsl:choose>
-                    <xsl:if test="$min=0 or $choice">}</xsl:if>
-                </xsl:for-each>
+                        <xsl:if test="$ordered">  <!-- pick up trailing cruft after final property before outer endElement and verify no trailing properties -->
+                            while (!reader.isStartElement() &amp;&amp; !reader.isEndElement())
+                                reader.next();
+                            if (reader.isStartElement())
+                                // A start element we are not expecting indicates a trailing invalid property
+                                throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getLocalName());
+                        </xsl:if>
 
-                <xsl:for-each select="property[@attribute]">
-                    <xsl:variable name="propertyName"><xsl:value-of select="@name"/></xsl:variable>
-                    <xsl:variable name="varName">bean.local<xsl:value-of select="@javaname"/></xsl:variable>
-                     <xsl:variable name="namespace"><xsl:value-of select="@nsuri"/></xsl:variable>
-                    <xsl:choose>
-                        <xsl:when test="@any and not(@array)">
-                            attribList.add(org.apache.axis2.databinding.utils.Constants.OM_ATTRIBUTE_KEY);
-                            attribList.add(<xsl:value-of select="$varName"/>);
-                        </xsl:when>
-                         <xsl:when test="@any and @array">
-                             for (int i=0;i &lt;<xsl:value-of select="$varName"/>.length;i++){
-                               attribList.add(org.apache.axis2.databinding.utils.Constants.OM_ATTRIBUTE_KEY);
-                               attribList.add(<xsl:value-of select="$varName"/>[i]);
+                        <xsl:if test="property[not(@attribute)]">  <!-- this if is needed to skip all this when there are no propoerties-->
+                        <xsl:if test="$unordered">
+                          <xsl:if test="not(property/enumFacet)">
+                             else{
+                                        // A start element we are not expecting indicates an invalid parameter was passed
+                                        throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getLocalName());
                              }
-                         </xsl:when>
-                        <xsl:otherwise>
-                            attribList.add(
-                            new javax.xml.namespace.QName("<xsl:value-of select="$namespace"/>","<xsl:value-of select="$propertyName"/>"));
-                            attribList.add(
-                            org.apache.axis2.databinding.utils.ConverterUtil.convertToString(<xsl:value-of select="$varName"/>));
-                        </xsl:otherwise>
-                    </xsl:choose>
-                </xsl:for-each>
-
-                return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray());
-            <!-- end of when for type & anon -->
-            </xsl:when>
-            <!-- Not a type and not anon. So it better be only one inclusion-->
-            <xsl:otherwise>
-                <!-- if the element is associated with a type, then its gonna be only one -->
-                //We can safely assume an element has only one type associated with it
-                <xsl:variable name="varName">bean.local<xsl:value-of select="property/@javaname"/></xsl:variable>
-                <xsl:variable name="nillable" select="property/@nillable"></xsl:variable>
-                <xsl:variable name="primitive" select="property/@primitive"></xsl:variable>
-                <xsl:variable name="propertyType" select="property/@type"></xsl:variable>
+                          </xsl:if>
+                             } else reader.next();  <!-- At neither a start nor an end element, skip it -->
+                            }  // end of while loop
+                        </xsl:if>
+                        </xsl:if>
 
-                <xsl:choose>
-                    <!-- This better be only one!!-->
-                    <xsl:when test="property/@ours">
 
-                        <xsl:choose>
-                            <xsl:when test="$nillable">
-                                if (<xsl:value-of select="$varName"/>==null){
-                                   return new org.apache.axis2.databinding.utils.reader.NullXMLStreamReader(bean.MY_QNAME);
-                                }else{
-                                   return <xsl:value-of select="$propertyType"/>Helper.getPullParser(<xsl:value-of select="$varName"/>,bean.MY_QNAME);
-                                }
-                            </xsl:when>
-                            <xsl:otherwise>return <xsl:value-of select="$propertyType"/>Helper.getPullParser(<xsl:value-of select="$varName"/>,bean.MY_QNAME);</xsl:otherwise>
-                        </xsl:choose>
-                    </xsl:when>
-                    <xsl:otherwise>
-                        <xsl:choose>
-                            <xsl:when test="$nillable and not($primitive)">
-                                if (<xsl:value-of select="$varName"/>==null){
-                                      return new org.apache.axis2.databinding.utils.reader.NullXMLStreamReader(bean.MY_QNAME);
-                                }else{
-                                   return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(bean.MY_QNAME,
-                                       new java.lang.Object[]{
-                                      org.apache.axis2.databinding.utils.reader.ADBXMLStreamReader.ELEMENT_TEXT,
-                                       org.apache.axis2.databinding.utils.ConverterUtil.convertToString(<xsl:value-of select="$varName"/>)
-                                       },
-                                       null);
-                                }
-                            </xsl:when>
-                            <xsl:otherwise> return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(bean.MY_QNAME,
-                            new java.lang.Object[]{
-                            org.apache.axis2.databinding.utils.reader.ADBXMLStreamReader.ELEMENT_TEXT,
-                            org.apache.axis2.databinding.utils.ConverterUtil.convertToString(<xsl:value-of select="$varName"/>)
-                            },
-                            null);</xsl:otherwise>
-                        </xsl:choose>
-                    </xsl:otherwise>
-                </xsl:choose>
-            </xsl:otherwise>
-        </xsl:choose>
+            } catch (javax.xml.stream.XMLStreamException e) {
+                throw new java.lang.Exception(e);
+            }
 
+            return object;
         }
 
+
+
 }
     </xsl:otherwise>
     </xsl:choose>