You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commons-dev@ws.apache.org by aj...@apache.org on 2006/04/28 12:30:44 UTC

svn commit: r397841 - /webservices/commons/trunk/modules/XmlSchema/src/org/apache/ws/commons/schema/SchemaBuilder.java

Author: ajith
Date: Fri Apr 28 03:30:41 2006
New Revision: 397841

URL: http://svn.apache.org/viewcvs?rev=397841&view=rev
Log:
Fixed a minor issue in the SchemaBuilder. When the schema has no target namespace the parent schemas targetnamespace was added as the default namespace. This functionality was changed not to put anything

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=397841&r1=397840&r2=397841&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 Fri Apr 28 03:30:41 2006
@@ -243,6 +243,8 @@
                 schema.namespaces.put("", map.item(i).getNodeValue());
             }
         }
+
+        //no targetnamespace found !
         if (schemaEl.getAttributeNode("targetNamespace") != null) {
             String contain = schemaEl.getAttribute("targetNamespace");
 
@@ -252,18 +254,17 @@
             if (!contain.equals(""))
                 schema.targetNamespace = contain;
         } else {
-            putNamespace("", schema.targetNamespace);
+           //do nothing here
         }
     }
 
     private void putNamespace(String prefix, String namespace) {
-        if (!schema.namespaces.containsKey(prefix)) {
-            schema.namespaces.put(prefix, namespace);
-        } else {
-            String genPrefix = "gen" +
+        while(schema.namespaces.containsKey(prefix)){
+           prefix = "gen" +
                     new java.util.Random().nextInt(999);
-            schema.namespaces.put(prefix, namespace);
         }
+        schema.namespaces.put(prefix, namespace);
+
     }
 
     XmlSchemaSimpleType handleSimpleType(XmlSchema schema,