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 di...@apache.org on 2006/09/27 07:02:36 UTC

svn commit: r450315 - /webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/SchemaCompiler.java

Author: dims
Date: Tue Sep 26 22:02:36 2006
New Revision: 450315

URL: http://svn.apache.org/viewvc?view=rev&rev=450315
Log:
deal with simple type restriction inside an attribute (see xmime xsd's contentType construct)

Modified:
    webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/SchemaCompiler.java

Modified: webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/SchemaCompiler.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/SchemaCompiler.java?view=diff&rev=450315&r1=450314&r2=450315
==============================================================================
--- webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/SchemaCompiler.java (original)
+++ webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/SchemaCompiler.java Tue Sep 26 22:02:36 2006
@@ -1373,18 +1373,26 @@
                 		QName attrTypeName = attribute.getSchemaTypeName();
                 		
                 		Object type = baseSchemaTypeMap.get(attrTypeName);
-                		if (type != null) {
-                		metainf.registerMapping(attrQname,attrQname,
-                        			type.toString(), SchemaConstants.ATTRIBUTE_TYPE);                			
+                		if (type == null) {
+                			XmlSchemaSimpleType simpleType = attribute.getSchemaType();
+                            if(simpleType.getContent() instanceof XmlSchemaSimpleTypeRestriction) {
+                                XmlSchemaSimpleTypeRestriction restriction = (XmlSchemaSimpleTypeRestriction) simpleType.getContent();
+                                QName baseTypeName = restriction.getBaseTypeName();
+                                type = baseSchemaTypeMap.get(baseTypeName);
+                                attrQname = att.getRefName();
+                            }
+                            //TODO: Handle XmlSchemaSimpleTypeUnion and XmlSchemaSimpleTypeList
+                        }
 
-                    		// add optional attribute status if set
-                    		String use = att.getUse().getValue();
-                    		if (use.indexOf("optional") != -1) {
-                    			metainf.addtStatus(att.getQName(), SchemaConstants.OPTIONAL_TYPE);
-                    		}        			
-                		} else {
-                			// TODO: This is no standard type - handle custom types here!
-                		}
+                        if (type != null) {
+                            metainf.registerMapping(attrQname,attrQname,
+                                        type.toString(), SchemaConstants.ATTRIBUTE_TYPE);
+                            // add optional attribute status if set
+                            String use = att.getUse().getValue();
+                            if (use.indexOf("optional") != -1) {
+                                metainf.addtStatus(att.getQName(), SchemaConstants.OPTIONAL_TYPE);
+                            }        			
+                        }
                 	}
                 }
             }



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org