Author: ajith
Date: Wed Apr 26 21:15:56 2006
New Revision: 397384

URL: http://svn.apache.org/viewcvs?rev=397384&view=rev
Log:
Fixing a namespace issue.For references in attribute types that do not contain 
a namespace prefix the schemabuilder picked up the targetNamespace. it should 
be the default namespace!

Modified:
    
webservices/commons/trunk/modules/XmlSchema/src/org/apache/ws/commons/schema/SchemaBuilder.java

Modified: 
webservices/commons/trunk/modules/XmlSchema/src/org/apache/ws/commons/schema/SchemaBuilder.java
URL: 
http://svn.apache.org/viewcvs/webservices/commons/trunk/modules/XmlSchema/src/org/apache/ws/commons/schema/SchemaBuilder.java?rev=397384&r1=397383&r2=397384&view=diff
==============================================================================
--- 
webservices/commons/trunk/modules/XmlSchema/src/org/apache/ws/commons/schema/SchemaBuilder.java
 (original)
+++ 
webservices/commons/trunk/modules/XmlSchema/src/org/apache/ws/commons/schema/SchemaBuilder.java
 Wed Apr 26 21:15:56 2006
@@ -1262,11 +1262,17 @@
                 Object result = schema.namespaces.get(type[0]);
                 if (result == null)
                     throw new XmlSchemaException("No namespace found"
-                            + " in given attribute type");
+                            + " in given attribute type for " + type[0]);
 
                 namespace = result.toString();
-            } else
-                namespace = schema.targetNamespace;
+            } else{
+                //if the namespace prefix is missing in a type then the correct
+                //resolution would be take the default namespace of the schema
+                //as the namespace of that type
+                // the default namespace has the empty prefix
+                namespace = schema.getNamespace("");
+            }
+
             name = Tokenizer.lastToken(name, ":")[1];
             attr.schemaTypeName = new QName(namespace, name);
         }
@@ -1906,7 +1912,7 @@
                             
resolveEntity(targetNamespace,schemaLocation,baseUri)
                     , null);
         } catch (Exception e) {
-           throw new RuntimeException(e);
+            throw new RuntimeException(e);
         }
 
     }
@@ -1919,8 +1925,8 @@
      */
     XmlSchema resolveXmlSchema(String targetNamespace,
                                String schemaLocation) {
-       return resolveXmlSchema(targetNamespace,schemaLocation,
-               collection.baseUri);
+        return resolveXmlSchema(targetNamespace,schemaLocation,
+                collection.baseUri);
 
     }
 


Reply via email to