cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bimargul...@apache.org
Subject svn commit: r761113 - /cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/types/SchemaJavascriptBuilder.java
Date Thu, 02 Apr 2009 00:05:22 GMT
Author: bimargulies
Date: Thu Apr  2 00:05:22 2009
New Revision: 761113

URL: http://svn.apache.org/viewvc?rev=761113&view=rev
Log:
CXF-2139, I hope.

Modified:
    cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/types/SchemaJavascriptBuilder.java

Modified: cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/types/SchemaJavascriptBuilder.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/types/SchemaJavascriptBuilder.java?rev=761113&r1=761112&r2=761113&view=diff
==============================================================================
--- cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/types/SchemaJavascriptBuilder.java
(original)
+++ cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/types/SchemaJavascriptBuilder.java
Thu Apr  2 00:05:22 2009
@@ -47,7 +47,6 @@
 import org.apache.ws.commons.schema.XmlSchemaObject;
 import org.apache.ws.commons.schema.XmlSchemaObjectCollection;
 import org.apache.ws.commons.schema.XmlSchemaObjectTable;
-import org.apache.ws.commons.schema.XmlSchemaSequence;
 import org.apache.ws.commons.schema.XmlSchemaSimpleType;
 import org.apache.ws.commons.schema.XmlSchemaType;
 
@@ -389,9 +388,8 @@
      */
     public void domDeserializerFunction(QName name, XmlSchemaComplexType type) {
         utils = new JavascriptUtils(code);
-        XmlSchemaSequence sequence = null;
-
-        sequence = XmlSchemaUtils.getSequence(type);
+        
+        List<XmlSchemaObject> contentElements = XmlSchemaUtils.getContentElements(type,
xmlSchemaCollection);
         String typeObjectName = nameManager.getJavascriptName(name);
         code.append("function " + typeObjectName + "_deserialize (cxfjsutils, element) {\n");
         // create the object we are deserializing into.
@@ -401,18 +399,19 @@
 
         utils.appendLine("var item;");
 
-        for (int i = 0; i < sequence.getItems().getCount(); i++) {
+        int nContentElements = contentElements.size();
+        for (int i = 0; i < contentElements.size(); i++) {
+            XmlSchemaObject contentElement = contentElements.get(i);
             utils.appendLine("cxfjsutils.trace('curElement: ' + cxfjsutils.traceElementName(curElement));");
-            XmlSchemaObject thing = sequence.getItems().getItem(i);
-            ParticleInfo itemInfo = ParticleInfo.forLocalItem(thing,
+            ParticleInfo itemInfo = ParticleInfo.forLocalItem(contentElement,
                                                               schemaInfo.getSchema(),
                                                               xmlSchemaCollection, 
                                                               prefixAccumulator, 
                                                               type.getQName()); 
             if (itemInfo.isAny()) {
                 ParticleInfo nextItem = null;
-                if (i != sequence.getItems().getCount() - 1) {
-                    XmlSchemaObject nextThing = sequence.getItems().getItem(i + 1);
+                if (i != nContentElements - 1) {
+                    XmlSchemaObject nextThing = contentElements.get(i + 1);
                     nextItem = ParticleInfo.forLocalItem(nextThing, 
                                                          schemaInfo.getSchema(), 
                                                          xmlSchemaCollection, 
@@ -426,7 +425,7 @@
                 }
                 deserializeAny(type, itemInfo, nextItem);
             } else {
-                deserializeElement(type, thing);
+                deserializeElement(type, contentElement);
             }
         }
         utils.appendLine("return newobject;");



Mime
View raw message