ws-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1171114 - /webservices/xmlschema/trunk/xmlschema-core/src/main/java/org/apache/ws/commons/schema/XmlSchemaSerializer.java
Date Thu, 15 Sep 2011 14:38:56 GMT
Author: dkulp
Date: Thu Sep 15 14:38:56 2011
New Revision: 1171114

URL: http://svn.apache.org/viewvc?rev=1171114&view=rev
Log:
[XMLSCHEMA-16] Output qnames for unions
Patch from Dmitry Repchevsky applied

Modified:
    webservices/xmlschema/trunk/xmlschema-core/src/main/java/org/apache/ws/commons/schema/XmlSchemaSerializer.java

Modified: webservices/xmlschema/trunk/xmlschema-core/src/main/java/org/apache/ws/commons/schema/XmlSchemaSerializer.java
URL: http://svn.apache.org/viewvc/webservices/xmlschema/trunk/xmlschema-core/src/main/java/org/apache/ws/commons/schema/XmlSchemaSerializer.java?rev=1171114&r1=1171113&r2=1171114&view=diff
==============================================================================
--- webservices/xmlschema/trunk/xmlschema-core/src/main/java/org/apache/ws/commons/schema/XmlSchemaSerializer.java
(original)
+++ webservices/xmlschema/trunk/xmlschema-core/src/main/java/org/apache/ws/commons/schema/XmlSchemaSerializer.java
Thu Sep 15 14:38:56 2011
@@ -613,13 +613,13 @@ public class XmlSchemaSerializer {
             choice.appendChild(annotation);
         }
 
-        List<XmlSchemaObject> itemColl = choiceObj.getItems();
+        List<XmlSchemaChoiceMember> itemColl = choiceObj.getItems();
 
         if (itemColl != null) {
             int itemLength = itemColl.size();
 
             for (int i = 0; i < itemLength; i++) {
-                XmlSchemaObject obj = itemColl.get(i);
+                XmlSchemaChoiceMember obj = itemColl.get(i);
 
                 if (obj instanceof XmlSchemaElement) {
                     Element el = serializeElement(doc, (XmlSchemaElement)obj, schema);
@@ -2138,6 +2138,29 @@ public class XmlSchemaSerializer {
         if (unionObj.getMemberTypesSource() != null) {
             union.setAttribute("memberTypes", unionObj.getMemberTypesSource());
         }
+        else {
+            QName[] memberTypesQNames = unionObj.getMemberTypesQNames();
+            if (memberTypesQNames != null && memberTypesQNames.length > 0) {
+                StringBuilder memberTypes = new StringBuilder();
+                for (int i = memberTypesQNames.length - 1; i >= 0; i--) {
+                    QName memberTypesQName = memberTypesQNames[i];
+                    String namespace = memberTypesQName.getNamespaceURI();
+                    if (namespace.length() != 0) {
+                        String prefix = schemaNamespace.get(namespace);                 
      
+                        if (prefix.length() != 0) {
+                            memberTypes.append(prefix).append(':');
+                        }
+                    }
+                    memberTypes.append(memberTypesQName.getLocalPart());
+                    if (i != 0) {
+                      memberTypes.append(' ');
+                    }
+                }
+                
+                union.setAttribute("memberTypes", memberTypes.toString());
+            }
+        }
+
         if (unionObj.getBaseTypes().size() > 0) {
             int baseTypesLength = unionObj.getBaseTypes().size();
             Element baseType;



Mime
View raw message